I am developing an Android Service basically I set an alarm every 3 minutes the Service starts,performs it’s tasks then stops and restarts again after 3 minutes. The problem is the service is consuming to much battery life draining the power from the device.
The task needs to be executed every 3 minutes.
Is there a solution for making it drain less power ? It’s better to keep it on all the time then starting and stoping it ?
Allow the user to control the polling period. You think it needs to be executed every 3 minutes. Your users may disagree, and since it is the user’s battery at issue here, the user deserves a vote.
Beyond that, you can do less work during each cycle.
That is unlikely to have a major impact on battery life. At an every-three-minute polling cycle, the battery consumption is likely to be driven much more by what you are doing during each cycle.
If your project can afford it, buy a Qualcomm MDP and use Trepn to get a much better handle on where your battery consumption is coming from.