Search code examples
androidoptimizationgeolocationsavebattery

how long manager location will listen to GPS provider without getting an answer when it set to 10 sec interval between updates


when a location manager is listening to a GPS provider with interval time of 10 secondes between notifications (it means that the second parameter of requestLocationUpdate is 10000) and the GPS doesn't have any signal, how long will the manager listen before stoping? or will it listen to the GPS provider until he gets the first location ?

it's very important because i'm trying to save as much battery as i can, and if the manager is listening until he gets the first location i would like to stop him after a short time.


Solution

  • when you start request location updates, the location listener will be triggered as soon as the location is found. And then the time interval factor comes in to picture which is 10 secs in your case, after which it will receive location again.

    so you can remove the location updates once the location has been found.