Expo Permission returns 'undetermined' in production

  1. SDK Version: 37.0.0
  2. Platforms: Android

In my expo app, (SDK Version 37.0.0) I ask the user for permission to access the camera roll as so:

  getPermissionAsync = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status !== "granted") {
      alert("Sorry, we need camera roll permissions to make this work!");
    }
    await this.setState({ permission: status === "granted" });
  };

  _pickMedia = async (index, type) => {
    if (this.state.permission != true) {
      await this.getPermissionAsync();
    }
    if (this.state.permission == true) {
        // get image
      } catch (E) {
        console.log(E);
      }
    }
  };

This works as expected during testing, repeatedly prompting the user for permission when they try to add an image until accepted. However, I have published the app to the Google Play Store and this version doesn’t work. Whether or not the user gives permission, the object returned by Permissions.askAsync has a status of undetermined and canAskAgain: false.

My app.json has these permissions:

    "android": {
      "permissions": ["READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE"],
    }

Please can someone tell me how to fix this error.

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