Is GPS update interval faster with a good signal?

I'm trying to limit my program to receive location updates every 10 seconds instead of constant updates to reduce battery drain. This works great when I am debugging a weak signal in the room (i.e., the GPS icon is blinking), but if the phone receives the correct correction (i.e., the GPS icon is static), the update interval increases to about a second.

I know the code is mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, updateInterval*1000, 0, this); It doesn’t force GPS to receive updates exactly in this interval, but, in my opinion, it should not depend on signal strength and vary greatly.

Any ideas?

UPDATE: see comment

+3
source share
2 answers

I suspect that the GPS radio works so that it is either connected to the GPS satellites or not. When it connects, the Android SDK sends you updates as often as they are available from the GPS hardware. When he does not have a full GPS connection, he returns to sending AGPS updates in accordance with the requests you requested.

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

+3
source

It may work slower because you are debugging, but not because your signal is weak! Try running tests with the indoor debugger turned off ...

0
source

Source: https://habr.com/ru/post/887056/


All Articles