What is WakeLock?

In order to prolong battery life, over time Android devices will first dim, then turn off the screen,
before turning off the CPU. WakeLocks are a Power Manager system Service feature, available to your
applications to control the power state of the host device.
Wake Locks can be used to keep the CPU running, prevent the screen from dimming, prevent the screen
from turning off, and prevent the keyboard backlight from turning off.

Creating and holding Wake Locks can have a dramatic influence on the battery
drain associated with your application. It’s good practice to use Wake Locks only
when strictly necessary, for as short a time as needed, and to release them as soon
as possible.

To create a Wake Lock, call newWakeLock on the Power Manager, specifying one of the following Wake
Lock types:
➤ FULL_WAKE_LOCK Keeps the screen at full brightness, the keyboard backlight illuminated,
   and the CPU running.
Keeps the screen at full brightness, and the CPU running.


Keeps the screen on (but lets it dim) and the CPU running.
Keeps the CPU running.
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,

PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
[ ... Do things requiring the CPU stay active ... ]


  1. I guess I am the only one who comes here to share my very own experience guess what? I am using my laptop for almost the post 2 years.
    ApowerManager Crack
    WonderShare Dr.Fone Crack
    VSO ConvertXtoDVD Crack


Post a Comment

Popular posts from this blog

Bluetooth Data Transfer Example

DeCompile .apk file on ubuntu 14.04