Baseflow / Baseflow/flutter-geolocator
[Enhancement proposal]: (iOS) Use new location apis to allow background location updates.
- 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) and verified I have added the required platform specific configuration.
### Please select affected platform(s)
- [ ] Android
- [X] iOS
- [ ] Linux
- [X] macOS
- [ ] Web
- [ ] Windows
### Proposal
With iOS 17 [liveUpdates](https://developer.apple.com/documentation/corelocation/cllocationupdate/liveupdates(_:)) was added. Using this api along with [backgroundActivitySession](https://developer.apple.com/documentation/corelocation/clbackgroundactivitysession-3mzv3) and setting permissions to always allow, will relaunch an app in the background when new positions come in even when an app is terminated.
### Pitch
Looking at the issues, this not working in the background is the most common question that is brought up under the iOS tag. This will fix it for iOS 17 and 18.
One potential issue with the new api does not allow any configuration for setting range/accuracy just [LiveConfiguration](https://developer.apple.com/documentation/corelocation/cllocationupdate/liveconfiguration).
iOS 18 also requires usage of [serviceSession](https://developer.apple.com/documentation/corelocation/clservicesession-pt7n) to launch the app in the background from my testing.
This is also a Swift only api. [background tracking info](https://developer.apple.com/documentation/corelocation/handling-location-updates-in-the-background#Receive-location-updates-in-the-background)
[wwdc24 video](https://www.youtube.com/watch?v=kHAEd-YEAEw) [wwdc23 video](https://www.youtube.com/watch?v=1WG91q2qKVI)
Contributor guide
Research direction
Start with the linked Core Location documentation for liveUpdates, backgroundActivitySession, and serviceSession, along with the referenced background-tracking guidance and WWDC videos. Done means supporting background location updates for iOS 17 and 18, including relaunch after termination, using the Swift-only APIs and always-allow permissions on the affected platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, ios, macos, swift
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100