Hm, apps shouldn't see the power key, that is consumed by the system.

On Sat, Feb 12, 2011 at 3:51 AM, Mark Murphy <mmur...@commonsware.com>wrote:

> In your own activity, you can watch for KEYCODE_POWER in onKeyDown(),
> apparently:
>
>
> http://stackoverflow.com/questions/3703071/how-to-hook-into-the-power-button-in-android
>
> Beyond that, I think you are out of luck.
>
> On Fri, Feb 11, 2011 at 9:32 PM, niko001 <ebs...@googlemail.com> wrote:
> > Hi,
> >
> > in reply to this discussion:
> >
> http://groups.google.com/group/android-developers/browse_thread/thread/491a9901f0cc58d6#
> > (which is too old to reply to):
> >
> > Is there any way to distinguish between "the user pressed the power
> > button" and "the screen timed out"? ACTION_SCREEN_OFF is sent in both
> > cases, but I need to single out the cases in which the user actively
> > pressed the power button.
> >
> > Thanks,
> > Nick
> >
> > --
> > 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
> >
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.4 Available!
>
> --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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

Reply via email to