react-native-radar icon indicating copy to clipboard operation
react-native-radar copied to clipboard

How can we tell when the user hasn't yet accepted or denied location permissions?

Open keith-kurak opened this issue 4 years ago • 1 comments

Summary

In my own project as well as the sample code, when the app runs for the first time, and location permissions have not yet been accepted or denied, getPermissionsStatus() returns DENIED. I'm used to other permissions requests providing a different value for if the user hasn't yet chosen either way (I figured this is what the UNKNOWN status would be for). Because of this, I can't tell whether the permissions were denied because the user actively denied them, or if they just weren't prompted yet, and I need to customize my app's messaging depending on whether the user is about to be prompted or not when I call requestPermissions(), as the prompt will not appear if the permissions were actually denied.

Just in case I could use getLocation() to make this determination, I checked both against these two cases.

Case 1: No option chosen yet for the location permission prompt Result of getPermissionStatus(): DENIED Result of getLocation(): ERROR_PERMISSIONS

Case 2: User rejected location permissions Result of getPermissionStatus(): DENIED Result of getLocation(): ERROR_PERMISSIONS

Thus, as far as I can tell, there is no way for me to tell if the user rejected permissions or hasn't yet chosen an option.

Code to reproduce

I just used the example from this repo, no changes, but I also saw the same thing when integrating the library into my own project

Steps to reproduce

  1. Download the example from this repo
  2. Yarn and pod install
  3. Run it
  4. Check the console log messages for the output of getPermissionsStatus()

OS version

macOS: 10.15.7 iOS: 14.3

SDK installation method

yarn / cocoapods

SDK version

3.0.6

Other information

keith-kurak avatar Feb 02 '21 18:02 keith-kurak

@llamaluvr This is great feedback, thanks. We'll look into adding a NOT_DETERMINED value in our next major release.

nickpatrick avatar Feb 02 '21 18:02 nickpatrick

@llamaluvr This should be fixed in https://github.com/radarlabs/react-native-radar/pull/146

brettguenther avatar Jun 30 '23 14:06 brettguenther