For which kinds of work I need to use CPU WAKE_LOCK in Sleep Mode?

114 views Asked by At

For which kinds of work I need to use CPU WAKE LOCK ? For example in Sleep Mode I am using TelephonyManager getCellLocation(), should I use PARTIAL_WAKE_LOCK in this case or not? I didn't find this info in the documentation. P.S. TelephonyManager has different API implementation on different devices so for me it looks tricky. Thanks.

2

There are 2 answers

0
pvllnspk On BEST ANSWER

After some investigation looks like for all operations that can not be triggered from Manifest using system intents.

0
Ashwin Surana On
**Flag Value                        CPU     Screen  Keyboard**

PARTIAL_WAKE_LOCK                    On*    Off     Off

SCREEN_DIM_WAKE_LOCK                 On     Dim     Off

SCREEN_BRIGHT_WAKE_LOCK              On     Bright  Off

FULL_WAKE_LOCK                       On     Bright  Bright

Incase you keep getting the location regularly even when the phone screen is turned off, use a partial wake lock to do so. From the above table we can see that a partial wake lock only keeps the CPU on while screen and keyboard is off(you dont require them as you just want to get location). Anyways refer to the below link for more info on WAKE LOCKS

http://developer.android.com/reference/android/os/PowerManager.html

Also refer to this question on SO, can be helpful

How can I keep my Android service running when the screen is turned off?