I've got a Listener for GPS Changes. It works correctly, but the battery gets a decreas of 0.4% per minute, which is not that nice :/ I am using GeoBeagle for GeoCaching on my G1 and it doesn't use that much energy. So I thought about that a bit...
I've got a Timer in the background (That timer was there before for other reasons), which ticks every 1000ms. So I thought, the following method would be better:
- I start the LocationListener
- If there is an update, I toggle a boolean var and turn off the Listener
- The timer is still ticking for another internal update every second, so I check if the boolean var is toggled and a counter is 5
- The Timer increases this counter, and if it reaches the 5 (after 5 x 1000ms) it will turn on the Listener again and toggle the boolean var back
- So the Listener can work after a location update and repeat the steps
This works fine! The little satelite icon appears....and disappears...and again...
Now my simple question: What is better/worse for the battery?
I thought, when I turn on/off the locationmanager every ~5.XXX seconds, it could be better for the battery...but it could also be worse, because maybe the battery is used more, to turn on/off the hardware for location recognition...I also could turn it to 10 seconds, but every higher value is senseless...
Oh, and I also tried the minDistance and minTime of the LocationListener...but the using of the battery is still the same like I would do it on every meter...well, actually it turned to ~0.39% per minute...still too much