Remove unwanted permissions from Expo app

Viewed 483

I developed an Expo app (managed) and generated the Android binary using EAS. After submitting the binary for internal testing, I see many dangerous unwanted permissions on the Google Play store.

unwanted permissions on Google Play store

The worse ones are "Camera: take pictures" and "Microphone: record audio." These scare away anyone concerned with privacy.

My app doesn't access the camera or the microphone, and I have no idea how these permissions got there.

I found questions related to React-Native and Android development, and their solution is to edit the AndroidManifest.xml. This solution is not compatible with my case, a Managed Expo environment. And no, I'm not ejecting the app.

PS: There are similar questions to this, but none related to Managed Expo environments - they are all about Android or React Native. Not the same thing.

2 Answers

Short answer:

On SDK 45+, use blockedPermissions to remove unwanted permissions:

"android": {
  // ...
  "blockedPermissions": [
    "android.permission.RECORD_AUDIO",
    "android.permission.CAMERA"
  ]
}

On SDK 44-, use permissions: []. This will not work on EAS builds though, you have to use Classic builds (retired in Jan 2023):

"android": {
  // ...
  "permissions": []
}

Long Answer

It happens that Expo automatically includes lots of permissions by default: camera access, microphone recording, read and write external storage, etc.

In the past, with Clasic Builds (retired in Jan 2023), the solution was to include a permissions key on app.json to remove permissions.

For example, to remove them all, we used to do this: "permissions": [].

The Classic builds were replaced by EAS builds, and they changed the behavior of permissions.

On EAS builds, you have to use blockedPermissions instead. But this keyword is only available on SDK 45+.

From Expo Github:

The permissions key works differently in classic builds vs EAS Build. on EAS Build, permissions is just for adding permissions, it doesn't remove any. blockedPermissions is only supported on EAS Build and SDK 45+ also.

To use ONLY the following minimum necessary permissions and none of the extras supported by Expo in a default managed app, set permissions to []. The minimum necessary permissions do not require a Privacy Policy when uploading to Google Play Store and are: • receive data from Internet • view network connections • full network access • change your audio settings • prevent device from sleeping To use ALL permissions supported by Expo by default, do not specify the permissions key. To use the minimum necessary permissions ALONG with certain additional permissions, specify those extras in permissions, e.g. [ "CAMERA", "ACCESS_FINE_LOCATION" ].

Thats why you have extra permissions, you can read about it here

Related