Search code examples
react-nativeandroid-permissions

Is there a way to remove default permissions in react-native without ejecting?


I want to remove default android permissions in react-native app:

  • READ_PHONE_STATE,
  • WRITE_EXTERNAL_STORAGE
  • READ_EXTERNAL_STORAGE.

The only way I found to do it, is to modify AndroidManifest.xml :

https://facebook.github.io/react-native/docs/removing-default-permissions.

My question is: there is a way to do it without ejecting my app? As I don't want to loose the features which Expo provides.


Solution

  • Take a loot at the docs.

    Where they say:

    Note: If you don't specify android.permissions inside your app.json, by default your standalone Android app will require all of the permissions listed above.

    Also look at:

    In order to request permissions in a standalone Android app, you need to specify the corresponding native permission types in the android.permissions key inside app.json read more about configuration. The mapping between Permissions values and native permission types is as follows

    You can add in your app.json only the permissions you want:

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