Tuesday, January 1, 2013

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

No comments:

Post a Comment