I have a GPS app that already requests ACCESS_FINE_LOCATION
permission in the manifest, now I want to add a library (MoPub) that requires ACCESS_COARSE_LOCATION
.
Am I correct in assuming that ACCESS_FINE_LOCATION
is enough, and I can leave out ACCESS_COARSE_LOCATION
from my manifest?
Another thing you should keep in mind that ACCESS_FINE_LOCATION gives you better and accurate location and ACCESS_COARSE_LOCATION gives you less accurate location.
If your app targets Android 12 or higher, the system logs the following error message in Logcat: ACCESS_FINE_LOCATION must be requested with ACCESS_COARSE_LOCATION. Note: To better respect user privacy, it's recommended that you only request ACCESS_COARSE_LOCATION .
Coarse location is for network provider's location and fine location is for both GPS provider and network location provider. So fine location covers both and you don't need to use anther one.
https://developer.android.com/guide/topics/location/strategies.html#Permission
Note: If you are using both NETWORK_PROVIDER and GPS_PROVIDER, then you need to request only the ACCESS_FINE_LOCATION permission, because it includes permission for both providers. (Permission for ACCESS_COARSE_LOCATION includes permission only for NETWORK_PROVIDER.)
In short: yes, you don't need ACCESS_COARSE_LOCATION
if you've already defined ACCESS_FINE_LOCATION
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With