简体   繁体   中英

Expo permissions not being granted - managed workflow - Android

I've built an app using Expo that enables a user to record a short video using the device camera, whereby it saves it to local device memory for further processing.

I've followed the Expo documentation to assign permissions for assigning permissions for iOS and Android apps ( https://docs.expo.io/versions/latest/sdk/permissions/ ).

iOS permissions are being granted and the recording component of my app is working as intended.

For android however only the Camera permission is being assigned - but not the others.

Here's my complete app.json file:

 {
  "expo": {
    "name": "App name",
    "slug": "appname",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "1.0.5",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "scheme": "myapp",
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#fa485d"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "android": {
      "package": "com.myappname.companionapp",
      "permissions": [ "CAMERA", "AUDIO_RECORDING" ],
      "versionCode": 3
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.myappname.companionapp",
      "buildNumber": "1.5.0",
      "infoPlist": {
        "NSCameraUsageDescription": "This app uses the camera to record videos",
        "NSMicrophoneUsageDescription": "This app uses the microphone to record audio while you are using the video camera"
    }},
    "web": {
      "favicon": "./assets/images/favicon.png"
    }
  }
}

I'm stumped on this as according to the docs I think I have configured everything correctly - any suggestions?

Figured out the answer, I needed to do two things.

a) In the app.json file I needed to change the permissions to RECORD_AUDIO per the code snippet below. "AUDIO_RECORDING" doesn't seem to work despite the docs reporting this.

"android": {
  "package": "com.myappname.companionapp",
  "permissions": [ "CAMERA", "RECORD_AUDIO" ],
  "versionCode": 3
}

b) Once I rebuilt the app I re-submitted as a newer version to the Google Play store, given I was requesting an additional permission (the automated update feature from Expo cannot request additional permissions without going via the formal app approval process).

Now it works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM