Skip to content

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

@lyair1

Description

@lyair1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions