在安卓GPS超时GPS

2023-09-07 09:29:29 作者:未曾忘妳

在黑莓中,我们使用超时拿到的位置,因此,如果它不在于多的时间内retun位置,我们结识。但在Android中,有超时的概念,任何人都可以请告诉替代方案,我们可以发现,经过这么多时间没有来自GPS没有位置更新。

In blackberry, we use a timeout to get the location, so that if it doesnt retun location in that much time period, we get to know. But in Android, there is no concept of timeout, can anyone please tell the alternative, that we can find out that after this much time there is no location update from GPS.

推荐答案

您可以使用两个线程超时。一个线程尝试获取GPS定位和其他(超时)线,一旦达到指定的超时时间,将删除你的应用程序的注册从位置监听器接收位置更新。

You can use two threads for this timeout. One thread tries to get the GPS fix and the other (timeout) thread, once it reaches the timeout specified, removes the registration of your application to receive location updates from the location listener.