Skip to content

Conversation

@sotomski
Copy link
Contributor

No description provided.

LocationEngine {

constructor() : this(getLocationTimeout = 5.seconds)
constructor() : this(getLocationTimeout = 5.seconds, enableBackgroundLocationUpdates = true)
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Collaborator

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 👍

@boldtrn
Copy link
Collaborator

boldtrn commented Jun 18, 2025

Please remember to add a changelog and increase the version number I'd say?

Copy link
Collaborator

@Fabi755 Fabi755 left a 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 🚀

@sotomski
Copy link
Contributor Author

My magic is no good here, tho ;) Could someone please hit the green button? 🙇

@boldtrn boldtrn merged commit a30fc5c into maplibre:main Jun 18, 2025
2 checks passed
@boldtrn
Copy link
Collaborator

boldtrn commented Jun 18, 2025

🪄 🧙 win gar dium levi ohhh sa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants