问题:onLocationListener 只调用一次

发布于 2024-11-27 04:30:19 字数 336 浏览 2 评论 0原文

我正在尝试获取当前位置的准确值,就像汽车定位器应用程序一样:您使用 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 技术交流群。

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

发布评论

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

评论(1

篱下浅笙歌 2024-12-04 04:30:19

如果您在视线范围内,您会以非常频繁的间隔获得位置更新。如果您在室内某个地方,而您的设备无法看到上方的 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.

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