Tuesday, January 1, 2013

[android-developers] Android 4.2.1 and Wake Locks

Hi everyone,

 

It seems that on my nexus 7 running android 4.2.1 the wake lock I have that on all other devices keeps the phone asleep and screen off to run a background service seems to wake the table up with the screen full bright. Why would it do this? I have a phone that is running 4.0.4 and it works correctly. Is there something I need to do differently?

 

Below is the code for my wake lock:

 

                                PowerManager pm1 = (PowerManager)context.getSystemService(Context.POWER_SERVICE);

              PowerManager.WakeLock wl1 = pm1.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "xxxxx");

             

              wl1.acquire(30000);

 

 

Thanks in advance,

 

Tommy

No comments:

Post a Comment