Baseflow / Baseflow/flutter-geolocator
No further position received from stream
- Dominant language
- Dart
- Stars
- 1.3k
- Forks
- 803
- Avg merge
- 8h 16m
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
With location permissions being set to "Accuracy: reduced" I only receive a position when starting the stream - but no further position.
### Expected behavior
At least with lowest accuracy submitted via settings there should be a constant position stream.
### Reproduction steps
Code, that starts the stream.
```
_positionStream = Geolocator.getPositionStream(
locationSettings: _getLocationSettings()
);
_positionSubscription = _positionStream!.listen((Position? position) {
if (position != null && state.status.isActive) {
add(PositionTracked(
delivery: delivery,
position: position
));
}
}, onError: (error) async {
try {
if (state.status.isActive) {
LocationPermission permissions = await _checkPermissions(
openAppSettings: true
);
if (permissions == LocationPermission.always ||
permissions == LocationPermission.whileInUse) {
add(TrackingStopped());
add(TrackingStarted());
}
} else {
throw error;
}
}
catch (_) {
rethrow;
}
});
LocationSettings _getLocationSettings() {
if (Platform.isAndroid) {
return AndroidSettings(
accuracy: LocationAccuracy.best
);
} else if (Platform.isIOS) {
return AppleSettings(
accuracy: LocationAccuracy.best,
pauseLocationUpdatesAutomatically: true,
showBackgroundLocationIndicator: false,
);
} else {
return const LocationSettings(
accuracy: LocationAccuracy.high,
distanceFilter: 100,
);
}
}
```
I also tried setting the accuracy to a lower mode step by step. But even with `lowest` there is no further action on the stream. `onError` did not get hit. I also added a `onDone` for testing purpose. But that did not get hit either.
The only received position was received within `onData` - so there was no extra call on something else.
### Configuration
**Version:** 1.x
**Platform:**
- [x] :iphone: iOS
- [ ] :robot: Android
Contributor guide
Research direction
Start with the Geolocator.getPositionStream call and the iOS branch of _getLocationSettings, then reproduce the reduced-accuracy case on iOS. Compare stream behavior across the listed accuracy settings and verify that the stream continues delivering positions after its initial event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, ios
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100