Do I need permission for background location on development phones?

Viewed 109

I was researching background location in Expo when I found that apps need permission from Google to use this on Android.

If the Android phones are running developer mode with sideloaded APK files, do they still need to have permission to use background location? If this is the case, is there any way to bypass it on a per-phone basis?

Thank you.

1 Answers

Allowing some apps to bypass location restriction is a security breach.

All apps must comply with the rules.

It is also our interest, as developers, to develop in real environment.

What you can do:

Create a script that installs your app and grant all location permissions using adb (replace com.name.app with your app package):

// Linux
./gradlew installDebug
// Windows
gradlew installDebug

adb shell pm grant com.name.app android.permission.ACCESS_COARSE_LOCATION
adb shell pm grant com.name.app android.permission.ACCESS_FINE_LOCATION
adb shell pm grant com.name.app android.permission.ACCESS_BACKGROUND_LOCATION

Edit

Just noticed that you work on react native, which I'm not familiar with

If you don't have gradlew commands, you can use adb install APK_PATH with the path of the apk, that is generated by react native.

Even better if you have a react native cli command to build and install app

Related