在 LocationManager 中获取错误位置
当将 LocationManager 与网络提供商一起使用时,我得到了完全错误的位置。我在非洲以外的海域找到了一个位置,精度约为 2000。我的 Google 地图显示了准确的位置。
有人知道问题出在哪里吗?当我使用getLastKnownLocation()
时,情况是一样的。
I get totally wrong location when using the LocationManager with the Network provider. I get a Location out in the sea outside Africa, the accuracy is around 2000. My Google Maps is showing the accurate position.
Does anyone have a idea about what the problem can be? It is the same when I use the getLastKnownLocation()
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
网络位置提供商极其不准确。通常如果你连接到 WiFi,你可以到达 100 米以内,但在手机信号塔上,2000 米是很正常的。珀赛,这并不是真正的问题。
如果 Google 地图能够在 GPS 关闭的情况下获得准确的位置,那么很可能是由于他们执行了一些非常先进的位置管理。但不幸的是,2000 米的网络定位在我的所有测试用例中都是正常的。
编辑:
当 getAccuracy() 返回值 2000 时,表示米。以下是文档关于
getAccuracy( )
:但它返回一个
float
值,虽然它不显示单位,但它仍然是米。The network location provider is extremely inaccurate. Usually if you are connected to WiFi, you can get within 100 meters, but on cell towers, 2000 meters is pretty normal. There's not really a problem, persay.
If Google Maps is able to get an accurate location with GPS turned off, then it is likely due to some very advanced location management that they do. But 2000 meters with Network Location, unfortunately, is normal in all of my test cases.
EDIT:
When getAccuracy() returns a value of 2000, it means meters. Here's what The Docs say about
getAccuracy()
:But it returns a
float
value, and while it doesn't display the unit, it is still meters.