views:

127

answers:

2

I will create a service to do something when some hot situation occurs.

By hot situation I mean:

  • the GPS/cell coordinates are in known zone;
  • known Bluetooth device detected;
  • known Wi-Fi network detected;
  • weather info has change;
  • considerable movement speed change detected: eg. from walking to travel by car.

As you see these tasks are heavy, and will be run frequently. 15 mins, but sometimes even more, when I have to detect the movement speed of the device.

The question I have, will this drain the battery heavily?

If so, what recommendations do you have to minimize battery drain with the above tasks?

+4  A: 

This might be of interest to you:

Coding for battery life

Russell Troywest
A: 

GPS is the top battery drainer - by having it on all the time, the battery duration will probably be cut down to half. Wireless connection is also quite a big drainer. If your app is working via the cell network, then if the phone is connecting to 3G then that probably drains as quickly as wireless connection anyway (maybe even more)...

I would suggest rethinking the usage of your service. Maybe make it into an app and have the user explicitly turning it on when he thinks to be in a "hot situation". Leave it as a service and the user might start thinking of your app as some sort of malfunctioning program and that will hurt severely your downloads/sales.

Also, to keep track of your apps battery usage, you can visit the "Battery usage panel" that lives inside Android preferences.

ruibm
Or at least allow the user the ability to configure the system to their needs. Have some sort of sliderbar or something with "Highly active/Bad on battery" to "Not very active/friendly to battery" so that they can decide how to use it. That way you can decide how often to turn on the GPS etc depending on the users choice of settings.
Russell Troywest