Take a look at the documentation on Intents:
http://developer.android.com/reference/android/content/Intent.html

Broadcasts:
ACTION_BOOT_COMPLETED - When phone is done booting
ACTION_SHUTDOWN - When phone is about to be shut down
ACTION_CAMERA_BUTTON - The camera button was pressed

Activity Actions:
ACTION_SEARCH_LONG_PRESS - The camera button was pressed for a "long" time

I don't think it is possible to know when the menu, or back button was
pressed unless you are already in your app.  AFAIK, the only way you can be
notified of the home button being pressed is to have your app replace the
home app.... You would use CATEGORY_HOME and ACTION_MAIN in that case.
However, once you are in your app, you will not be able to get a
notification when the home key is pressed.  I have tried and Android
specifically prevents this from happening.

It is a little infuriating (yet understandable) when you are trying to do
something that would be a great benefit to the phone but can't.

Hope this helps,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Thu, Nov 12, 2009 at 6:14 PM, andjarnic <[email protected]> wrote:

> Hey all,
>
> Still learning this amazing platform. Long time Java developer, new to
> Android architecture. I am curious if there is an intent (er..event?)
> that is broadcasted when the power button is pressed to turn the phone
> off or on, same with volume and camera buttons.. and the four buttons
> home/menu/back/search? How would I register a listener for all these
> buttons?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en

Reply via email to