Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[],[],null,["When it's necessary, you can use wake locks to keep the device from going to\nsleep.\n\nUnder some circumstances, you may need to keep the device awake even when your\napp is in the background. To do this, you can create a *wake lock*.\n\nYour feedback is a crucial part of improving our documentation. Please give us\nyour feedback using the following link:\n\n\n[Give feedback](https://docs.google.com/forms/d/e/1FAIpQLSc0OMFG-G88ZyHh_xwauaM2gimwP9-MFvRd6C49q0atZNpZ9w/viewform?usp=dialog)\n| **Note:** Creating and holding wake locks can have a dramatic impact on the device's battery life. You shouldn't use wake locks if there are any suitable alternatives. For other options, see the [Choose the right API to keep the device awake](/develop/background-work/background-tasks/awake) documentation. If you do need to use a wake lock, make sure to hold it for as short a time as possible.\n\nThis guide explains the following areas:\n\n- [Set a wake lock](/develop/background-work/background-tasks/awake/wakelock/set)\n- [Release a wake lock](/develop/background-work/background-tasks/awake/wakelock/release)\n- [Follow wake lock best practices](/develop/background-work/background-tasks/awake/wakelock/best-practices)\n- [Debug wake locks locally](/develop/background-work/background-tasks/awake/wakelock/debug-locally)\n- [Identify wake locks created by other APIs](/develop/background-work/background-tasks/awake/wakelock/identify-wls)\n\nThis guide assumes you're familiar with the following topics:\n\n- [Choose the right API to keep the device awake](/develop/background-work/background-tasks/awake)\n- [Request runtime permissions](/training/permissions/requesting)"]]