gpt4 book ai didi

android - 从 Android 上的 GPS 供应商获取*粗略*位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:55:35 25 4
gpt4 key购买 nike

我的应用程序只需要非常粗略的位置数据,所以我最初将我的 list 权限设置为 ACCESS_COARSE_LOCATION,并为 NETWORK_PROVIDER 设置了一个位置监听器。这为我提供了我所需要的粗略位置估计,但前提是启用了 Google 定位服务。

我原以为如果用户只启用了 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?

引用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.

但是,我假设这不会取代 LocationManager 中的“将无法访问 GPS”声明。我假设这意味着 NETWORK_PROVIDER 数据可能会被禁止,如果它被认为太准确的话。

关于android - 从 Android 上的 GPS 供应商获取*粗略*位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14460888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com