Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old December 2nd, 2012, 03:28 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Nov 2012
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about Screen Control using Wakelocks

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.)?

dragonnis is offline  
Reply With Quote
sponsored links
Old December 3rd, 2012, 02:51 PM   #2 (permalink)
New Member
 
Join Date: Aug 2010
Posts: 12
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

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
galth is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:08 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.