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 updates when NSLocationWhenInUseUsageDescription is set #20911
Enable background updates when NSLocationWhenInUseUsageDescription is set #20911
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Generated by 🚫 dangerJS |
This looks like a straightforward fix, can you sign the CLA so we can proceed? |
I have signed the CLA |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
I think it failed because it's been a long time since the PR was originally opened, and our tooling was not able to apply the patch. If you rebase, we can try importing again. |
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.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Aditya Koukuntla merged commit 3ca3332 into |
Description
Location updates are not working in background when user allows When in use authorization, but works when user allows Always allow.
In Geolocation/RCTLocationObserver.m, setAllowsBackgroundLocationUpdates are set only for Always allow case, but native iOS allows us to setAllowsBackgroundLocationUpdates even for When in use authorization.
Solution:
setAllowsBackgroundLocationUpdates is now set for both cases.
Changelog
[iOS] [Fixed] RCTLocationObserver - Enable background location updates when NSLocationWhenInUseUsageDescription is set
Test Plan
Target: iOS 11+
Permissions:
-> Permissions.request('location', { type: 'always' })
-> set location in the UIBackgroundModes.
-> geolocation.watchPosition();
-> Background the application and you would see location updates works even when app is in background. On iOS 11+ a blue banner on top is displayed showing "Your application is Actively Using Your Location".