Skip to content
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

Expose a method to set allowsBackgroundLocationUpdates #11

Merged
merged 1 commit into from
Nov 25, 2015
Merged

Expose a method to set allowsBackgroundLocationUpdates #11

merged 1 commit into from
Nov 25, 2015

Conversation

bruz
Copy link
Contributor

@bruz bruz commented Nov 24, 2015

Enabling this appears to be necessary in order to have location updates fire when the app is backgrounded, when linking against iOS 9. From the docs:

Apps that want to receive location updates when suspended must include the UIBackgroundModes key (with the location value) in their app’s Info.plist file and set the value of this property to YES. The presence of the UIBackgroundModes key with the location value is required for background updates; you use this property to enable and disable the behavior based on your app’s behavior. For example, you might set the value to YES only after the user enables features in your app where background updates are needed.

When the value of this property is NO, apps receive location updates normally while running in either the foreground or background based on its current authorization. Updates stop only when the app is suspended, thereby preventing the app from being woken up to handle those events.

The default value of this property is NO. Setting the value to YES but omitting the UIBackgroundModes key and location value in your app’s Info.plist file is a programmer error.

Enabling this appears to be necessary in order to have location updates
fire when the app is backgrounded, when linking against iOS 9.
timfpark added a commit that referenced this pull request Nov 25, 2015
Expose a method to set allowsBackgroundLocationUpdates
@timfpark timfpark merged commit d461e04 into timfpark:master Nov 25, 2015
@timfpark
Copy link
Owner

Thanks! One thing though: I think this facebook/react-native#1282 might mean that despite this, you will not get events. There might be a fix in 0.14 for this but I haven't had time to verify yet.

@bruz
Copy link
Contributor Author

bruz commented Dec 1, 2015

Just as a follow up for anyone else happening across this, I've played with this quite a bit now and can confirm that locationUpdated events do fire when monitoring for significant location changes and the app is backgrounded. The amount of work you can get done in response to it does seem quite limited before the javascript thread pauses again though.

@bruz bruz deleted the allows-background-location-updates branch December 1, 2015 17:22
@timfpark
Copy link
Owner

timfpark commented Dec 1, 2015

That's great news @bruz - thanks for the update - which version of react-native did you verify that with?

@bruz
Copy link
Contributor Author

bruz commented Dec 1, 2015

Ah, right, forgot to mention that part. I did indeed have issues with react native 0.13, but with 0.15 it's working.

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.

2 participants