Use this to see what wake locks are being held in user space:

adb shell dumpsys power

Note that the device never goes to sleep while plugged in to USB.  Also the
system will never hold a wake lock for you just because you have an activity
or service running.  You can have it do so for you in an activity via
FLAG_KEEP_SCREEN_ON in a window, and the alarm manager will temporarily hold
one for you while sending an alarm broadcast to a broadcast receiver.

On Wed, Apr 14, 2010 at 12:18 AM, westmeadboy <[email protected]>wrote:

> So I tried this:
>
> Start service
> Press Home
> Start some other 3rd party app (so that activity is in the foreground)
> Press power button to blank screen
>
> A few minutes later, I press the power button to unblank the screen
> and discover the service finished successfully.
>
> This means the phone never went to sleep...
>
> Any ideas why?
>
> On Apr 13, 2:01 pm, Mark Murphy <[email protected]> wrote:
> > westmeadboy wrote:
> > > Hmmm, so in that case, why does the device not sleep after the user
> > > has used the power button to turn off the screen? Or do you mean that
> > > the activity is still considered in the foreground even after that?
> >
> > My guess is that it is still considered the foreground until a real
> > activity (i.e., not the lock screen) takes the foreground.
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://twitter.com/commonsguy
> >
> > Android Training in NYC: 4-6 June 2010:http://guruloft.com
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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