Tuesday, January 1, 2013

RE: [android-developers] Android 4.2.1 and Wake Locks

That appears to have worked. I'll be honest, I have no idea why or when that
2nd parameter got put in.

As always, thank you mark for the advice!

-----Original Message-----
From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Mark Murphy
Sent: Tuesday, January 01, 2013 1:14 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Android 4.2.1 and Wake Locks

On Tue, Jan 1, 2013 at 12:29 PM, Tommy <droidap@gmail.com> wrote:
> 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);

The combination of PARTIAL_WAKE_LOCK and ACQUIRE_CAUSES_WAKEUP is bizarre,
IMHO. If you do not want the screen to turn on, get rid of
ACQUIRE_CAUSES_WAKEUP.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre
desenvolvimento de aplicações para Android:
http://www.andglobe.com

--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment