Hi, I used the same snippet. I am also facing the same problem. The 
wakelock doesnt work when the phone is unplugged. Why is that?

On Tuesday, November 6, 2012 3:57:47 AM UTC+2, Glen wrote:
>
> pm = (PowerManager) getSystemService(Context.POWER_SERVICE); 
> wakeLockOn = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
> "YourService.java");  // PARTIAL_WAKE_LOCK forces the cpu to run even 
> if the screen is off 
> if ( wakeLockOn.isHeld() == false ) { wakeLockOn.acquire(); } 
>
> This works for me when the phone is plugged in.  Not so much when it's 
> unplugged. 
>
> On Nov 5, 1:50 pm, Archana <[email protected]> wrote: 
> > Hi, 
> > 
> > I want to implement WakeLock in android for a service. I want the device 
> to 
> > keep executing a service, even when it is in sleep mode.
> https://github.com/commonsguy/cwac-wakefulprovides basic usage/alarm 
> > usage. I am not sure which one I should use. 
> > 
> > Can someone suggest me, if I have to use Alarm Manager orhttp://
> stackoverflow.com/questions/2039555/how-to-get-an-android-wake... 
> > ? 
> > 
> > Thanks in advance! 
>

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

Reply via email to