flutter-geolocator
flutter-geolocator copied to clipboard
[Question]: Ios background stop location updates
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation.
Please select for which platform(s) you need help
- [ ] Android
- [X] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Your question
Hello. We have integrated your location library but when the app is switched to the background on an iOS device, the interception of positioning changes stops within a few seconds. It works in the foreground but when the app is minimized it stops.
We have followed your example with the following code.
final LocationSettings locationSettings = LocationSettings( accuracy: LocationAccuracy.high, distanceFilter: 100, );
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen( (Position? position) { print(position == null ? 'Unknown' : 'Geolocator ${position.latitude.toString()}, ${position.longitude.toString()}'); });
info.plist
How can we use the library so that, when the application is in the background, it does not constantly send position changes to a server?
Thanks
Version
12.0.0
same issue.
when app killed in IOS , unable to listen location updates.
Hi @mayank-vinove
With the app. in background you can listen location changes after 5 secs?
As per my understanding minimum interval is 15 min but iam unable to get a callback after every ~15 min.
But there are a multitude of apps with background tracking like Google Maps, Waze, Uber, etc. I think there is a way to be able to track location in the background, for example for interaction with beacons.
No coments?
Dear @tarilo,
Can you check if it works as expected in the supplied example app? Also check if you requested the correct permissions and added the correct permission to the pod file. Furthermore, check if you used the correct plist entries.
Kind regards,
@tarilo This plugin does not have any reference to https://developer.apple.com/documentation/corelocation/cllocationmanager/startmonitoringsignificantlocationchanges() which is probably what you are looking for. This is the api that allows terminated apps to start and receive notification changes when the location has changed.
edit: Some new iOS apis support restarting the process when the app is terminated https://github.com/Baseflow/flutter-geolocator/issues/1567
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.