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

getCurrentPosition Prompts the "Always Location" permission instead of the "On Use" permission #11822

Closed
lyair1 opened this issue Jan 11, 2017 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@lyair1
Copy link

lyair1 commented Jan 11, 2017

Description

I have 2 scenarios in my app, the first one requires "Only in use" and the second requires "Always".

Most of my users are going to use only the first scenario (only in use).

I have an issue that when I call 'getCurrentPosition' (in RCTLocationOberver.m) from the first scenario flow (the one the requires only the "in use" permission) the "always in use" permission is being prompt by the iOS.

By looking at the code it's very simple to understand why it happens (method: beginLocationUpdatesWithDesiredAccuracy).

Is there any way to force it to prompt the right permission in this case? i'm afraid my users will not give consent to the permission because a fear of giving the app permissions for locations in the background.

I think this all started with this bug:
#1506

Reproduction

Add descriptions for both "always" and "in use" locations.
Call 'getCurrentPosition()' - obviously, you don't need the 'Always' permission for that. You will see that iOS prompt the "always in use" permission.

Solution

I think that reversing the IF statement in 'beginLocationUpdatesWithDesiredAccuracy' will fix this issue, I can't think about any scenario that will break due to this change.

#11823

Additional Information

  • React Native version: 0.40
  • Platform: iOS
  • Operating System: All
@lyair1
Copy link
Author

lyair1 commented Jan 11, 2017

Added a pull request for the simple change

@hramos
Copy link
Contributor

hramos commented May 25, 2017

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

@hramos hramos closed this as completed May 25, 2017
@hramos hramos added the Icebox label May 26, 2017
@ngandhy
Copy link
Contributor

ngandhy commented Aug 18, 2017

IMO this should be reopened given the new iOS location permissions model. It seems we will be strongly encouraged to ask for "When in App" before "Always". In order for that to happen, this needs to be fixed.

@hramos
Copy link
Contributor

hramos commented Aug 18, 2017

@ngandhy it looks like @lyair1 submitted a PR but closed it before it was reviewed: #11823

If you're still interested in seeing this fixed, I'd recommend either sending a PR, or opening a new issue with more context (since @lyair1's issue has seen no followup from them since January).

@ngandhy
Copy link
Contributor

ngandhy commented Aug 19, 2017

Hey @hramos - It looks like there are a few PRs submitted last month that would solve this, so I'll refrain from adding another.

One of these pull requests seems to have been in "review-needed" for a while and the other looks like its waiting on a response. Anything I can do to help push these along? I figure the sooner we get one through the less back and forth there will be because of conflicts.

See: #15067
See: #15096

Thanks for your help!

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants