Android:强制使用 Wi-Fi 作为位置提供程序

发布于 2024-10-03 15:19:51 字数 243 浏览 3 评论 0原文

据我了解,我有三个位置提供商可供选择:GPS、网络和被动。

我想通过检测我连接的 Wi-Fi 网络来获取我的位置,我相信网络提供商涵盖了小区三角测量和 Wi-Fi 位置确定。

然而,尽管已连接到 Wi-Fi 接入点,我的程序似乎总是使用单元格三角测量而不是 Wi-Fi 来确定我的位置(基于返回坐标的巨大不准确性假设)。

好像没有办法强制只使用Wi-Fi吧? Android 如何决定何时使用 Wi-Fi 而非蜂窝三角测量?

As I understand it, I have three location providers to choose from: GPS, Network and Passive.

I would like to obtain my location by detecting the Wi-Fi network I'm connected to, I believe both Cell Triangulation and Wi-Fi location determination is covered under the Network provider.

However, despite being connected to a Wi-Fi access point, my program always seems to use cell triangulation rather than Wi-Fi to determine my location (assumed based on the huge inaccuracy of the returned coordinates).

It doesn't look like there's any way to force the use of Wi-Fi only? How does Android decide when to use Wi-Fi over cell triangulation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨巷深深 2024-10-10 15:19:51

我认为当从wifi芯片扫描到的wifi信息与远程Google数据库的数据匹配时,它使用wifi(我不知道这个数据库的覆盖范围,但它应该包括所有有街景的城市)。否则它使用精度低得多的单元三角测量。

要检查使用哪种类型,您可以尝试 LocationProvider.requireCell() (尚未测试过...)

I think it uses wifi when the wifi information scanned from the wifi chipser matches data the remote Google database (I don't know the coverage of this database, but it should include all cities that have StreetView). Else it uses the far less accurate cell triangulation.

To check which kind is used, you might try LocationProvider.requireCell() (haven't tested it...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文