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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With