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?

2 Likes

I have same issue, Google play rejected my app because of this. how can i remove location permissions.

in google mail

Since your app does not need background location, please request to remove background usage and reach compliance:
For any APKs targeting Android 10 or newer (SDK level 29 or higher):
Remove the ACCESS_BACKGROUND_LOCATION permission from your app APK or app bundle
If you’re using ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION, examine your code paths and restrict usage to foreground purposes only (learn more)
You should no longer see the Location declaration listed under App Content
For any APKs targeting Android 9 or older (SDK level 28 or lower):
If you’re already using ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION, examine your code paths and restrict usage to foreground purposes only (learn more)
In your console declaration, select “No” to the question “Does your app access location in the background in APKs or app bundles targeting Android 9 or older?”

there is notihing about location in my app but google rejected my app. how can I solve this issue?

As far as I understand it, this feature should not cause a problem.

Are you really using Expokit? Or are you using the Bare workflow? Or the Managed workflow? What Expo SDK version are you using?

What have you tried? Have you seen the following documentation?

I am producing app with expo build:andorid

it is okay now,
app.json
permissions:[ ]

solved probably. but now I lost IOS icons. there is all question marks instead of icons in production

it sounds like you ejected your app and then maybe did some other changes? if all you changed was permissions: in app.json, that certainly would have no impact on your ios app