1

I was wondering if anyone has created an app that starts in the background and utilizes the GPS to gather the current Lat and Long every minute or so? If you have, would you please provide your battery times? As in, how long does your phone last until its all out of juice from just running that background app with standard cell phone programs.

I'm trying to see if it would be worth the time to create an app for myself but if i work for 8 hours and dont have a way of charging my phone during that time then i dont want to be going home and it shut down on me since my app i would create works at my house. I need the app to work since it will see when i am in range of my home (from the GPS) and then send commands to my server at the house from my phone. So thats why it would need to be able to stay in the background doing a check every 1 minute or so.

Or only turn on the GPS (Is this doable with iOS &or Android?) whenever its after 5pm each day so that it will minimize the load on the battery?!?

Any help or suggestions would be great! Thanks!

StealthRT
  • 10,108
  • 40
  • 183
  • 342

1 Answers1

5

It looks like we worked on same requirement. My code sends GPS location to server on regular interval ( say 1 min, 5 min, 15 min... as per user requirement ) untill now my code was like it constantly open the GPS so battery life was very few hours like 3-4 hours ( when device/phone is full charged ).

After searching on Stack Overflow i come to this answer. Now to solve battery issue i again re-design the application in such a way that GPS start when application is going to upload the data and stops in 30 seconds.

Also I change code from TimerTask Class to AlarmManger class so it users much lesser memory.

After these changes my application works 10 hours for 1 min interval ( when phone is full charge ) and so on.

Normally battery life is 20 hours, and no interval is set like that it can extends that period, so i got optimum level like 2 minutes.

Or only turn on the GPS (Is this doable with iOS &or Android?) whenever its after 5pm each day so that it will minimize the load on the battery?!?

I suggest you to look AlarmManager class's example. It would be the best solution for you. your application will be very light weighted.

Community
  • 1
  • 1
Lucifer
  • 29,392
  • 25
  • 90
  • 143
  • I don't know who down voted you but i added my own vote to it so it wouldn't be negative anymore! Thanks for the helpful information and link! – StealthRT Sep 13 '12 at 11:46
  • Thanks Lucifer for your test. It's quite hard to find some real numbers about location provider battery consumption – peter.bartos Jun 05 '13 at 10:19
  • have you tried an interval with more than 3 minutes (amount of time iOS allows to executes in the bg) to not get the app suspended/killed by the OS in the background? – SleepNot Jun 25 '14 at 18:27