Ragunath Jawahar Ragunath Jawahar - 2 months ago 38
Android Question

Difference between Wakelock and FLAG_KEEP_SCREEN_ON?

Keeping the screen awake can be accomplished by using a wakelock by

mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,

Or by adding the FLAG_KEEP_SCREEN_ON to the window,


What is the technical difference between the two and in terms of performance and battery life which is recommended?


A wakelock gives you way more control (Like waking the phone to download something without turning the screen off) and requires your application to hold the wakelock permission.

Therefore FLAG_KEEP_SCREEN_ON is recommended if all you want is to keep the screen on while your window is visible.