我有一个使用GPS的应用程序。
我的问题是,当我到达GPS正在寻找信号但找不到它的部分时,它只是继续搜索。这会杀死电池。
我用了这个:
this.locationManager.requestLocationUpdates(this.provider, 0,
0, pendingIntent);
但它只设置刷新率。 如果GPS没有锁定,它会继续尝试。
我希望它在尝试锁几分钟后停止。
我能做什么?
如果您不想经常检查新位置,则必须指定最小时间和最小距离。 结构是这样的:
public void requestLocationUpdates (String provider, long minTime, float minDistance, PendingIntent intent)
有关更多信息,请查看此链接 : http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28java.lang.String,%20long,%20float,%20android.app.PendingIntent%29
编辑:对不起,我不明白你的问题。 检查此链接,您要做的是设置超时。希望这个帮助.如何使 GPS 信号采集超时