Clear granted Expo.Permissions, show Permissions popup again onButtonPress

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();
    }
  }
1 Like

Hi! Can you tell us which platform you’re using? On Android the user can select “Never ask for this permission again” which means that askAsync will return without prompting the user.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.