Get * rough location from GPS provider on Android

My application only needs very rough location data, so I initially set my explicit access permissions to ACCESS_COARSE_LOCATION and set up the location receiver for NETWORK_PROVIDER . This gave me exactly the kind of rough estimate of the location I needed, but only with Google Location Services turned on.

I expected that if the user only had GPS turned on, I would still get a rough estimate of their location. But it seems that the only way to get ANY location data from GPS_PROVIDER is with ACCESS_FINE_LOCATION permission.

So, is it true that only with GPS turned on, the application cannot receive location information if it does not have ACCESS_FINE_LOCATION permission? In other words, GPS_PROVIDER cannot send approximate location estimates if the app only has ACCESS_COARSE_LOCATION permission?

+6
source share
1 answer

So, is it true that only with GPS turned on, the application cannot receive location information if it does not have ACCESS_FINE_LOCATION permission?

Generally speaking, yes.

Quote documentation for LocationManager :

If your application has only rough resolution, it will not have access to GPS providers or passive locations. Other providers will still return search results, but the update speed will be reduced and the exact location will be launched to a crude level of accuracy.

In other words, GPS_PROVIDER cannot send approximate location estimates if the app only has ACCESS_COARSE_LOCATION permission?

Indication of release notes for Android 4.2 :

Compared to previous versions of Android, user search results may be less accurate if your application requests ACCESS_COARSE_LOCATION permission but does not request ACCESS_FINE_LOCATION permission. To meet user privacy expectations, when your application requests permission for a rough location (rather than an exact location), the system will not provide a user’s location estimate more accurate than a city block.

However, I assume that this does not cancel the statement “will not have access to GPS” from the LocationManager . I assume this means that NETWORK_PROVIDER data may be locked if it is considered too accurate.

+6
source

All Articles