5
votes

I have an React Native Expo project that started out using the Expo "managed workflow". However, since then I have ejected out of the managed workflow (while still using some expo modules).

The issue I'm experiencing is that Expo seems to have added arbitrary permission requests to my Android app. I must remove this particular permission request from the app: android.hardware.location.

I've tried many ways to remove it in my AndroidManifest.xml file, for example:

<uses-permission tools:node="remove" android:name="LOCATION_HARDWARE" />
<uses-permission tools:node="remove" android:name="ACCESS_COARSE_LOCATION" />
<uses-permission tools:node="remove" android:name="ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location" android:required="false" tools:node="remove" />

But in the end the bundled Android app still requests the android.hardware.location permission.

How can I remove it before bundling the app?

2
This issue was resolved by removing the expo dependency from package.json. The expo dependency required expo-location which in turn requested various android location permissions. - ixuz07

2 Answers

2
votes

for excluding any permission that expo is adding automatically, according to the expo documentation you should just add tools:node="remove" to your manifest permission element. now if you want to remove location permission this should solve your issue:

<manifest ... xmlns:tools="http://schemas.android.com/tools">
 ...
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
 ...
</manifest>

By adding these, hardware location permission should be gone too. don't forget to add tools namespace to the root element of your manifest

-3
votes

This issue was resolved by removing the expo dependency from package.json.

The expo dependency required expo-location which in turn requested various android location permissions.