Skip to content

Most visited

Recently visited


Managing Device Awake State

Dependencies and prerequisites

  • Android 1.6 (API Level 4) or higher

Try it out

Download the sample

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.


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.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)