Android:强制使用 Wi-Fi 作为位置提供程序
据我了解,我有三个位置提供商可供选择: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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为当从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...)