Battery-Effects with GPS and a LocationListener

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Battery-Effects with GPS and a LocationListener

Postby Keenora » Wed Feb 10, 2010 2:16 pm

Hey guys!
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 ;)
User avatar
Keenora
Freshman
Freshman
 
Posts: 5
Joined: Wed Feb 03, 2010 2:08 pm

Top

Postby eppinator » Wed Apr 07, 2010 11:01 am

nice approach and Interesting question.
I would also be interested in what is best. As well es compared to the NMEA listener instead of the gps-provider, particularly when I think of the problem with the gps provider I wrote here about...
eppinator
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Feb 11, 2010 1:00 pm

Postby Keenora » Wed Apr 07, 2010 12:17 pm

Well, actually, I played around a bit more. I handle it like this as default, but its possible to turn that functionallity off.

Fact: It IS better for the battery to turn it on/off.

If I turn it on, its no problem to use the gps for hours. It uses 0.1154% of the battery per minute now (In the last calculation I forgot the display >.<). So, if I just use the gps and turning off the display, which is not necessary for my app, I can track for more than ~13 hours. Well, the signal is a bit laggy then, yeah, BUT, you have to decide for being exact, without my on/off-listener, or being a bit laggy, e.x. for walking/running/cycleing, and getting more time. I also tested it with driving a car for 5 hours from my hometown in germany to paris. It worked fine aswell. Maybe I should test it on the next flight ^^°

Anyway, its more useful then the listener-preferences itself. Of course you can use the min-dsitance and min-time update-preferences. But the listener is still running then.
User avatar
Keenora
Freshman
Freshman
 
Posts: 5
Joined: Wed Feb 03, 2010 2:08 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests