GPS更新间隔为具有良好的信号快? [英] GPS update interval is faster with good signal?

查看:206
本文介绍了GPS更新间隔为具有良好的信号快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制我的程序采取以减少电池消耗每10秒位置更新,而不是不断更新。这工作时,我调试室内罚款和信号弱(即GPS图标闪烁),但如果手机得到适当修正(即GPS图标是静态的)更新间隔增加到大约一秒钟。

I'm trying to limit my program to take location updates every 10 seconds instead of constant updates in order to reduce battery drain. This works fine when i'm debugging indoors and the signal is weak (i.e. the GPS icon flashes), but if the phone gets a proper fix (i.e. the GPS icon is static) the update interval increases to roughly a second.

我知道,code mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,updateInterval * 1000,0,这一点); 将不强制GPS采取准确的更新在给定的时间间隔,但在我看来它不应该取决于信号的强度和波动太大

I know that the code mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, updateInterval*1000, 0, this); will not force the GPS to take updates exactly at the given interval, but in my opinion it shouldn't depend on the strength of the signal and fluctuate that much.

任何想法?

更新:见注释

推荐答案

我怀疑是GPS无线电在任何它连接到GPS卫星的方式工作,或者它不是。当它连接了Android SDK向您发送尽可能频繁它们可从GPS硬件更新。当它没有它回落到根据您什么要求发送AGPS更新一个完整的GPS连接。

I suspect that the GPS radio works in a manner where either it's connected to GPS satellites or it's not. When it's connected, the Android SDK sends you updates as frequently as they're available from the GPS hardware. When it doesn't have a full GPS connection it falls back to sending AGPS updates according to what you've requested.

如果您只想更新每隔10秒,您应该保存最后收到的的位置时间值在你的听众,当你收到一个新的位置检查其对旧值的时间;忽略它,如果它过于频繁(或做一些更聪明如检查的准确性和更换旧值等)。

If you only want updates every 10 seconds, you should save the last received Location's time value in your listener, and when you receive a new Location check its time against the old value; ignore it if it's too frequent (or do something smarter like checking the accuracy and replacing the old value, etc).

这篇关于GPS更新间隔为具有良好的信号快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆