1. Check out our companion app, Forums for Android! Download from Google Play

Question about Screen Control using Wakelocks

Discussion in 'Application Development' started by dragonnis, Dec 2, 2012.

  1. dragonnis

    dragonnis Member
    Thread Starter

    Nov 4, 2012
    I was toying around with different ways of turning the screen on and off and of course Wakelocks show up quite alot in this discussion. From what I gather, I can acquire a wakelock (partial or full) to turn the screen on and keep it on for the whole duration my app (or service) is running, and then release it to turn the screen off. My question is on the huge issue of battery consumption surrounding wakelocks. As long as I make sure to to acquire it just to keep the screen on and release it to turn the screen off (or when the screen turns off), battery consumption should be minimal right? The wakelock's only there when the screen is on so it will definitely let the phone go into deep sleep when the screen's off but does the wakelock actually consume battery itself while it's acquired? Or is all the fuss just bad programming (leaving the wakelock on when the screen turns off, etc.)?


  2. galth

    galth Member

    Aug 5, 2010
    Wakelocks can definitely eat battery. They keep the processor running, and depending on the level of the lock will keep the screen on until the lock is released, and by your description it sounds like your trying to keep the screen on. The power button will still put the device to normal sleep mode unless you use a partial lock, but otherwise cannot go to sleep.

    If you need to keep the screen on for some period or to subvert the normal sleep mode use a wakelock, but release it as soon as possible.

    If you haven't already be sure to read the power management reference PowerManager | Android Developers

Share This Page