问题:onLocationListener 只调用一次
我正在尝试获取当前位置的准确值,就像汽车定位器应用程序一样:您使用 GPS 位置来标记您的汽车所在的位置。
问题是 onLocationListener 仅被调用一次,并且第一次修复可能不如我想要的那么准确。因此我想听听五次更新以获得更准确的位置。 我注册更新是这样的: RequestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsLocationListener);
如果我在移动,我会收到很多更新,但是当我静止不动时,我只会收到一个更新。
如何强制它即使在静止不动的情况下也能获得更多更新以获得更准确的位置?
I'm trying to get an accurate value of current position, much like a car locator app: You use GPS
position to tag where your car is.
The problem is that onLocationListener is only called once, and that first fix might not be as accurate as I want. Therefore I want to listen to, say five updates to get a more accurate position.
I register for updates like this:
RequestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsLocationListener);
If I'm moving I get a lot of updates, But when standing still I only get one update.
How to force it to get more updates even when standing still to get a more accurate position?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在视线范围内,您会以非常频繁的间隔获得位置更新。如果您在室内某个地方,而您的设备无法看到上方的 GPS 卫星,则您将无法进行任何位置修复,因此也不会进行位置更新。
If you are in line-of-sight, you would get location updates at a much frequent interval. In case you are inside somewhere, where your device can not have a line-of-sight to the GPS satellites above, you would not any location fix and hence no location updates.