what is a static wakelock?
satya - Saturday, May 22, 2010 11:09:16 AM
android wakelock
android wakelock
satya - Saturday, May 22, 2010 11:12:27 AM
use
Class lets you say that you need to have the device on. Call release when you are done and don't need the lock anymore
satya - Saturday, May 22, 2010 11:15:30 AM
methods
acquire
isHeld
Release
satya - Saturday, May 22, 2010 11:16:36 AM
The parent class: PowerManager docs
satya - Saturday, May 22, 2010 11:19:02 AM
Example
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock
(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();
//..screen will stay on during this section..
wl.release();
satya - Saturday, May 22, 2010 11:25:53 AM
constants
ACQUIRE_CAUSES_WAKEUP: Normally wake locks don't actually wake the device, they just cause it to remain on once it's already on.
FULL_WAKE_LOCK: Wake lock that ensures that the screen and keyboard are on at full brightness.
ON_AFTER_RELEASE: When this wake lock is released, poke the user activity timer so the screen stays on for a little longer.
PARTIAL_WAKE_LOCK: Wake lock that ensures that the CPU is running.
SCREEN_BRIGHT_WAKE_LOCK: Wake lock that ensures that the screen is on at full brightness; the keyboard backlight will be allowed to go off.
SCREEN_DIM_WAKE_LOCK: Wake lock that ensures that the screen is on (but may be dimmed); the keyboard backlight will be allowed to go off.
satya - Saturday, May 22, 2010 11:50:37 AM
Design considerations
Choose the write constant. Looks like partial_wake_lock is a better choice if you care only about CPU being running.
Pay attention to when you acquire the wake lock as the system may have gone to sleep before acquiring it.
Try not use it as it can drain the battery