Baseflow / Baseflow/flutter-geolocator
[Question]: Updating accuracy/distanceFilter while the Position stream is running
- Dominant language
- Dart
- Stars
- 1.3k
- Forks
- 803
- Avg merge
- 8h 16m
- Merged PRs (30d)
- 1
Description
### Please check the following before submitting a new issue.
- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [X] I have carefully [read the documentation](https://github.com/baseflow/flutter-geolocator/blob/main/geolocator/README.md).
### Please select for which platform(s) you need help
- [X] Android
- [X] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
### Your question
First of all, thank you for the great plugin!
I'm building a navigation app that needs low frequency (high `distanceFilter` and `intervalDuration`) location updates at the beginning but higher frequency (low `distanceFilter` and `intervalDuration`) as the user reaches the end of their journey.
IIUC iOS recommends adjusting the `desiredAccuracy` and `distancefilter` values to optimize for battery usage. It makes sense that this applies to Android as well.
Is there a way to update these values without cancelling and re-creating the Position stream?
Or is there a way to retain the Foreground service even when cancelling and re-creating the stream?
Because otherwise on Android re-creating fails with `android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false`; as applications running in the background cannot create foreground services.
I'm happy to contribute a PR if this feature does not exist and you'd be willing to point me in the right direction.
### Version
12.0.0
Contributor guide
Assessment
This issue has not been assessed yet.