5

No message is being prompted. It just denies the permission. I have also made same, the targetedSdk version and compilesdk version.

I've made same, the targetedSdk version and compilesdk version.

My function on 'Request' Button:

try {
  const granted = await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.CAMERA,
    {
      'title': 'Cool Photo App Camera Permission',
      'message': 'Cool Photo App needs access to your camera ' +
                 'so you can take awesome pictures.'
    }
  )
  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    alert("You can use the camera")
  } else if (PermissionsAndroid.RESULTS.DENIED){
    console.log("Camera permission denied")
  }
} catch (err) {
  console.warn(err)
}

I expect a prompt message and by tapping 'Yes', it must grant the permission but no prompt is shown.

  • what's your compileSdkVersion & targetSdkVersion? I think that it should not matter as long as the targetSdkVersion is above 23 – Kushal Desai Jan 25 '21 at 10:02
  • Were you able to find a solution for the same? I am facing the same issue with targetSdkVersion = 29. – User3250 Mar 30 '21 at 15:29

1 Answers1

8

You need to also add in the permissions to the Manifest file for Android or the pList in iOS.

For Android:

Add this to your Manifest:

<uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />

https://developer.android.com/reference/android/hardware/Camera

For iOS

Take a look here: iOS 10 - Changes in asking permissions of Camera, microphone and Photo Library causing application to crash

JRK
  • 3,686
  • 1
  • 13
  • 19