Camera permissions not updating only in the released app

Please provide the following:

  1. SDK Version: 37
  2. Platforms(Android/iOS/web/all): Android

Hello there, I am having issues with the Camera permissions but only in the released version of the app. It is working fine in the IOS sim and in android devices using the expo client. But when it is in the play store release it still says I don’t have permission to use the Camera.

This app was built from the start with SDK 33, I started working in this app a couple of months ago* and needed to update to SDK 37, my guess is as the perms config changed the issue might be here. If yes, how do I debug it as it works fine in dev…

Hey @morenomdz,

Can you share how you are requesting permissions for the Camera module and as for testing the production environment, please see this section of the docs: Building Standalone Apps - Expo Documentation

Cheers,
Adam

Sure, not on my machine right now but I will update with the code later tonight. Question, when we have the expo server running in “prod” mode, and I load the app from the expo client in lets say my android device, what kind of differences are there to the built app, an apk for example?

  handleImagePicker() {
    Alert.alert(
      'Select image',
      'Please select camera or gallery to add the image.',
      [
        { text: 'Cancel' },
        {
          text: 'Gallery',
          onPress: () => this.chooseImage(false)
        },
        { text: 'Camera', onPress: () => this.chooseImage(true) }
      ],
      { cancelable: false }
    );
  }
 async chooseImage(useCamera) {
    const { warn } = this.props;
    if (!(await checkPermission(useCamera))) {
      warn(
        'Camera permission is required to take image',
        'Permission missing.'
      );
      return;
    }
    const method = useCamera ? 'launchCameraAsync' : 'launchImageLibraryAsync';
    const result = await ImagePicker[method]({
      allowsEditing: true,
      quality: 0.5,
      base64: false,
      aspect: [4, 3]
    });
    if (!result.cancelled) {
      this.handleInput('imgUrl', result.uri);
    }
  }

And the helper

const checkPermission = async isCamera => {
  const permission = isCamera ? 'camera' : 'cameraRoll';
  const granted = await Permissions.getAsync(permission);
  if (granted.status === 'granted') {
    return true;
  }
  return (await Permissions.askAsync(permission)).status === 'granted';
};

This is the way it was setup when I started working in the app, it works in dev and local devices testing via expo client, but do not in the released version. It asks for permission once and do nothing more.

Can you elaborate on what you mean by “it asks for permission once and do nothing more.” Only being able to ask for a permission once is expected behavior as you can read here: https://docs.expo.io/versions/v38.0.0/sdk/permissions/#manually-testing-permissions

Oh sorry I expressed myself badly there, it does ask for permission as it should, it is saving the permission (as it works in the expo client and sim) but it does not open the camera (or asks what camera app you want to use).

Then if I try to use the same button again it does nothing, but if I try to do another action that would use the camera as well, it then says the app has no permission.

At first it makes me think it is something returning early in the helper function after the permission is set once, but, why does it not open the camera App and why does it says the permission is not set if I try something else?

After updating to sdk38 I know have this warning when navigating into the User component which had the camera permission issue.

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