我期待如果用户只启用了GPS,我仍然可以得到他们位置的粗略估计.但似乎从GPS_PROVIDER获取任何位置信息的唯一方法是使用ACCESS_FINE_LOCATION权限.
那么,只有启用GPS,应用程序无法接收位置信息,除非它具有ACCESS_FINE_LOCATION权限吗?换句话说,如果应用只有ACCESS_COARSE_LOCATION权限,则GPS_PROVIDER无法发送粗略的位置估算值?
解决方法
So,is it true that with only GPS enabled,an app cannot receive location information unless it has the ACCESS_FINE_LOCATION permission?
一般来说,是的.
引用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?
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.
但是,我假设这不会取代LocationManager中的“将无法访问GPS”语句.我认为这意味着如果认为NETWORK_PROVIDER数据太准确,可能会被禁止.