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

Enable background updates when NSLocationWhenInUseUsageDescription is set #20911

Conversation

KoukuntlaAditya
Copy link

@KoukuntlaAditya KoukuntlaAditya commented Aug 29, 2018

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".

@facebook-github-bot
Copy link
Contributor

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!

@pull-bot
Copy link

Warnings
⚠️

📋 Release Notes - This PR may have incorrectly formatted Release Notes.

Generated by 🚫 dangerJS

@react-native-bot react-native-bot added ✅Test Plan Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Aug 29, 2018
@react-native-bot react-native-bot added ✅Release Notes and removed Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Oct 1, 2018
@react-native-bot react-native-bot added the No CLA Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2019
@hramos hramos changed the title Fix to enable background updates when NSLocationWhenInUseUsageDescrip… Enable background updates when NSLocationWhenInUseUsageDescription is set Jan 29, 2019
@hramos
Copy link
Contributor

hramos commented Jan 29, 2019

This looks like a straightforward fix, can you sign the CLA so we can proceed?

@KoukuntlaAditya
Copy link
Author

This looks like a straightforward fix, can you sign the CLA so we can proceed?

I have signed the CLA

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2019
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@react-native-bot react-native-bot removed the No CLA Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2019
@hramos hramos self-requested a review January 30, 2019 06:57
@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Jan 31, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Jan 31, 2019
@facebook-github-bot
Copy link
Contributor

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.

@hramos
Copy link
Contributor

hramos commented Jan 31, 2019

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.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 15, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@react-native-bot
Copy link
Collaborator

Aditya Koukuntla merged commit 3ca3332 into facebook:master.

@facebook facebook locked as resolved and limited conversation to collaborators Feb 15, 2019
@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 15, 2019
@hramos hramos removed Import Failed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Needs: Rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants