-
-
Notifications
You must be signed in to change notification settings - Fork 74
Enable background location updates on AppleLocationEngine #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable background location updates on AppleLocationEngine #166
Conversation
| LocationEngine { | ||
|
|
||
| constructor() : this(getLocationTimeout = 5.seconds) | ||
| constructor() : this(getLocationTimeout = 5.seconds, enableBackgroundLocationUpdates = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default be true? Or if the user has not provided the permissions, will there just be no updates when the screen is locked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recon for most navigation apps, background location updates are a good thing.
If the the proper background mode is not declared in the Info.plist, the app will crash.
https://developer.apple.com/documentation/corelocation/cllocationmanager/allowsbackgroundlocationupdates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think also, that is a common use case for navigation apps.
If you don't like it @boldtrn, we can think about a README note for iOS setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I am fine either way, we can add it to the Readme or just enable this by default. It's important that his does not crash the app, if everything is configured the right way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # | App wants BG updates? | Info.plist declares UIBackgroundModes = location |
CLLocationManager .allowsBackgroundLocationUpdates |
Runtime outcome |
|---|---|---|---|---|
| 1 | No | No | No | Works, foreground-only |
| 2 | No | No | Yes | 💥 Crash (fatal error) |
| 3 | No | Yes | No | Works, foreground-only |
| 4 | No | Yes | Yes | Gets background updates (wasted battery) |
| 5 | Yes | No | No | Runs, but no BG updates |
| 6 | Yes | No | Yes | 💥 Crash (fatal error) |
| 7 | Yes | Yes | No | Runs, but no BG updates |
| 8 | Yes | Yes | Yes | ✅ Current PR solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So a resonable default depends what's the default expectation of the app.
If we assume the app doesn't need background location updates, a better approach is NOT to enable them by default.
If we assume the app does need background location updates, it's better to enable them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sure, let's enable it 👍
|
Please remember to add a changelog and increase the version number I'd say? |
Fabi755
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Let's go 🚀
|
My magic is no good here, tho ;) Could someone please hit the green button? 🙇 |
|
🪄 🧙 win gar dium levi ohhh sa |
No description provided.