Saturday, February 12, 2011

Re: [android-developers] Distinguish between Power button and Screen timeout

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 <ebsget@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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment