Re: [android-developers] Android 4.2.1 and Wake Locks
On Tue, Jan 1, 2013 at 12:29 PM, Tommy droi...@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, x); wl1.acquire(3); 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
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 droi...@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, x); wl1.acquire(3); 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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Android 4.2.1 and Wake Locks
On Tue, Jan 1, 2013 at 2:26 PM, Tommy droi...@gmail.com wrote: I'll be honest, I have no idea why or when that 2nd parameter got put in. It would be useful for any of the other WakeLock types, where you want the screen to display (and to actually turn on if it is already off). I filed a feature request to have a Lint check to flag this combination: http://code.google.com/p/android/issues/detail?id=42169 -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en