page.title=Managing Device Awake State page.tags=wakelock, AlarmManager, WakefulBroadcastReceiver trainingnavtop=true startpage=true @jd:body

Dependencies and prerequisites

Try it out

Download the sample

Scheduler.zip

When an Android device is left idle, it will first dim, then turn off the screen, and ultimately turn off the CPU. This prevents the device's battery from quickly getting drained. Yet there are times when your application might require a different behavior:

This class describes how to keep a device awake when necessary without draining its battery.

Lessons

Keeping the Device Awake
Learn how to keep the screen or CPU awake as needed, while minimizing the impact on battery life.
Scheduling Repeating Alarms
Learn how to use repeating alarms to schedule operations that take place outside of the lifetime of the application, even if the application is not running and/or the device is asleep.