Search code examples
javaandroidwakelock

Reducing power consumption


For my application, I want to have a Notification sent to the user at a specified time. To do this, I have set up a Timer and the corresponding TimerTask. To be sure the Notification will be sent to the user even if the phone is aslept, I have acquired a PARTIAL_WAKE_LOCK. The problem is that this method draws a lot of power from my battery (my application is responsible for more than 50% of all the power consumption at the end of the day).

Is there another way (a more power efficient one of course) to do what I want to do?

Thanks in advance for the time you will spend trying to help me.


Solution

  •   > Is there another way (a more power efficient one of course) to 
      > [have a Notification sent to the user at a specified time]?
    

    You can use an the android AlarmManager for this.

    See Using AlarmManager to Schedule Activities on Android as a tutorial and example.