React-native-permissions: [iOS] Permission check return 'undetermined' instead of 'denied' after revoking permission for the 1st time after installing the app

Created on 21 Feb 2019  Â·  13Comments  Â·  Source: zoontek/react-native-permissions

  • React-Native version: 0.55.4
  • Platform: iOS
  • Device (which one?), ip6 simulator & ip6 real device
  • OS version: (Simulator: 12.1 & Device: 11.4.1)
  • react-native-permissions version: 1.1.1
  • Devtools: Xcode 10.1

How to repeat issue and example

I work on push notification permission.

At start, I ask for permission then allow the push notification.

I enter the view that has a button to check the current permission. The click event is like below:

Permissions.check('notification').then(response => {
          switch (response) {
            case 'authorized':
            case 'denied':
            case 'restricted':
              this.setState({ isNotificationSelected: !this.state.isNotificationSelected })
              Permissions.openSettings()
              break
            case 'undetermined':
              Permissions.request('notification').then(response => {
                this.setState({ isNotificationSelected: response === 'authorized' })
              })
              break
          }
        })

The idea is that if the permission prompt hasn't been shown before (undetermined) then ask for it. Otherwise, open the settings.

-> Click the button and it open the settings, then I turn the notification permission off. and go back to the app.

In the view I have a callback event to detect "resume" event:

AppState.addEventListener('change', (state) => {
      if (state === 'active') {
        this.checkNotificationStatus() //I log the response here in this method
      }
    })

This this.checkNotificationStatus() method log the response of "undetermined" which is not correct, it should be "denied" (Because the permission dialog has been shown before)

Then the next time I click the button. It's "undetermine" so It call the ask for permission (Which won't happen because it has been shown before). And since the 2nd click, it works as normal ("denied" response). It only happens once.

NOTE: It only happens the first time after reinstalling the app (no matter if I uninstall then install or just over write the current app)

Solution

None

Most helpful comment

Having the same issue, check notification returns undetermined if permission has been denied or if it's actually undetermined. It does return authorized if permission was granted :/

I'm using RN 0.57.8

All 13 comments

  • React-Native version: 0.55.4
  • Platform: Android
  • Device (which one?), Mi A2 Global Edition
  • OS version: (Device: 9)
  • react-native-permissions version: 1.1.1

Same happens when I tried to check camera permission on Android. Expected result is to be 'restricted' but I got undetermined every time for single or multiple permissions.

On IOS is the same, always returns undetermined even If I denied the permission.

Having the same issue, check notification returns undetermined if permission has been denied or if it's actually undetermined. It does return authorized if permission was granted :/

I'm using RN 0.57.8

Any update?

Having this same issue when checking Notification permissions. The status is undetermined in both of these cases:

  • Fresh install, user has not yet been asked to grant permissions
  • User has explicitly denied permissions at the OS-level
React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 5.06 GB / 32.00 GB
      Shell: 2.7.1 - /usr/local/bin/fish
    Binaries:
      Node: 8.11.3 - /usr/local/bin/node
      Yarn: 1.12.3 - ~/.yarn/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6
      react-native: 0.59.5 => 0.59.5
    npmGlobalPackages:
      react-native-cli: 2.0.1

Same issue. Permissions.check('notification') is returning undetermined when it should be denied

Same issue, any solution?

@zoontek has confirmed this issue is resolved in the upcoming 2.0.0 version: https://github.com/react-native-community/react-native-permissions/pull/291#issuecomment-495789859

Since 2.0.0 is still in the works and includes many breaking changes including requiring React 0.60, it would be great if this bug was patched in the current version for folks who aren't prepared or able to update to React 0.60, which is a significant undertaking.

I think for the people having android issues the reason this package doesn't list support for notification permissions for android is because android doesn't require consent for that permission. The android docs state that it's not a dangerous permission to a user's privacy.

having the same issue here using Microphone permission in Android.
Permissions.check('microphone') is returning undetermined when it should be denied

@zoontek Just a quick question before I submit an issue — is there a reason this lib (particularly 2.0.0) doesn't include permission checks for Touch ID? Perhaps they aren't necessary? Thanks!

@petekp As I know, TouchID does not ask for an authorization when you first use LAContext evaluatePolicy method. https://developer.apple.com/documentation/localauthentication/lacontext/1514176-evaluatepolicy?language=objc

This is a permission request:

Ios_11_biometricid_face_id_permission

TouchID only have authentification requests:

1_vU1Q2tyhAB0yoTVoEa_a7Q

I am closing this since this issue does not exists anymore with the 2.0.0 release.

Was this page helpful?
0 / 5 - 0 ratings