Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove "android.hardware.location" permission request from ejected Expo project?

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?

like image 738
ixuz07 Avatar asked Nov 26 '22 23:11

ixuz07


1 Answers

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

like image 188
houman.sanati Avatar answered Dec 15 '22 18:12

houman.sanati