I have an app that when I'm running with Expo, the permissions work fine and the dialog box appears to accept or deny them. However, when I generate the apk with expo build:android and install it on my phone, the app does not ask me for permissions. In application manager my app does not show any permissions that have been accepted or rejected so I cannot manually enable them.
This is my App.json
{
"expo": {
"name": "dev-1",
"slug": "dev-1",
"privacy": "public",
"sdkVersion": "36.0.0",
"platforms": ["ios", "android", "web"],
"version": "1.0.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.fernandoAzarias.tenedores",
"permissions": ["CAMERA_ROLL", "LOCATION"],
"versionCode": 2
},
"description": "An app just for learn React Native"
}
}
This is a part of the code that obtains the permissions
const changeAvatar = async () => {
const resultPermissions = await Permissions.askAsync(
Permissions.CAMERA_ROLL
);
console.log(resultPermissions);
setLog([...log, resultPermissions]);
if (resultPermissions.granted) {
const result = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true,
aspect: [4, 3]
});
setLog saves the permissions object, which allows me to display them on the screen. I am getting this as a response:
{
canAskAgain: false
expires: never,
granted: false
Permissions: {
cameraRoll: {
canAskAgain: false
expires: never
granted: false
status: denied
}
}
}
Clearly the app does not have permissions, but in the application manager the app does not have any permissions and it does not show anything, so I cannot enable disable.
I hope you can help me.
From my experience with expo, in the first place it depends on the sdk, then you must take into account the list of permissions that it must have when it is already a compiled app, as indicated in the documentation.
In other words: ["CAMERA_ROLL"] works as long as you're in development, ["CAMERA"] works when it's ready for "production"
You can find the list of permissions here: https://docs.expo.io/versions/latest/sdk/permissions/#permissionscamera
You can also check the permissions that an android device has here. https://developer.android.com/reference/android/Manifest.permission#CAMERA