I noticed that Expo automatically saves a cache of the permission granted by the user.
For eg: I granted a Permissions.CAMERA, the next time the app is run on Expo, it automatically calls a status of granted or denied.
Now when the permission is denied, I have a button to show the Permissions popup again, but it doesn’t work, cause the permission is already set to denied. Is there any way to clear the permissions or the async/await function? Thanks.
componentDidMount() {
this.getCameraPermission();
}
onButtonPress() {
this.getCameraPermission();
}
async getCameraPermission() {
const { status: existingStatus } = await Permissions.getAsync(Permissions.CAMERA);
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.CAMERA);
finalStatus = status;
}
if (finalStatus !== 'granted') {
return;
} else if (finalStatus === 'granted') {
Actions.showCamera();
}
}