React-native-permissions: Device camera permission status always giving me Authorized

Created on 11 Jul 2017  路  4Comments  路  Source: zoontek/react-native-permissions

Hi,
in manifest I have put <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" />,
but when I am changing the permissions for all them like camera,photo,storage etc , and trying to get there permissions status it always give me authorized. I used bellow code
Permissions.check(['camera']) .then(response => { console.log(response ); //response is one of: 'authorized', 'denied', 'restricted', or 'undetermined' this.setState({ photoPermission: response }); });

Most helpful comment

If your target API is below 23, the android permission API is not the same and does not provide the possibility to request permission at run time. Actually, the permissions writed in your manifest are automaticly granted at installation. You must target API 23 or greater to request permission at run time (and react-native-permissions as well)

All 4 comments

Which API do you target ? (https://developer.android.com/guide/topics/manifest/uses-sdk-element.html)

currently I am targeting for bellow versions and want to use the camera api which ask allow or deny popup if permission in not given
android:minSdkVersion="16"
android:targetSdkVersion="22" />

If your target API is below 23, the android permission API is not the same and does not provide the possibility to request permission at run time. Actually, the permissions writed in your manifest are automaticly granted at installation. You must target API 23 or greater to request permission at run time (and react-native-permissions as well)

Aye it working after changing this.

Was this page helpful?
0 / 5 - 0 ratings