Get *coarse* location from GPS provider on Android

五迷三道 提交于 2019-12-05 07:07:15

So, is it true that with only GPS enabled, an app cannot receive location information unless it has the ACCESS_FINE_LOCATION permission?

Generally speaking, yes.

Quoting the documentation for LocationManager:

If your application only has the coarse permission then it will not have access to the GPS or passive location providers. Other providers will still return location results, but the update rate will be throttled and the exact location will be obfuscated to a coarse level of accuracy.

 

In other words, the GPS_PROVIDER can't send rough location estimates if the app only has ACCESS_COARSE_LOCATION permission?

Quoting the Android 4.2 release notes:

Compared to previous versions of Android, user location results may be less accurate if your app requests the ACCESS_COARSE_LOCATION permission but does not request the ACCESS_FINE_LOCATION permission. To meet the privacy expectations of users when your app requests permission for coarse location (and not fine location), the system will not provide a user location estimate that’s more accurate than a city block.

However, I am assuming that this does not supersede the "will not have access to the GPS" statement from LocationManager. I assume that this means that NETWORK_PROVIDER data might be inhibited, if it is deemed too accurate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!