Getting headphone button push event


Last Updated:

  1. diegoesp

    diegoesp Member This Topic's Starter

    Joined:
    Jan 4, 2010
    Messages:
    6
    Likes Received:
    0
    Hi everyone,

    is there any way to detect when the user pushes the headphone button from code ? (via an intent, maybe ?). I just can't find the way to do it.

    For example, the music player stops playing when it's pressed.

    Thanks !
     

    Advertisement
  2. KeithG

    KeithG Well-Known Member

    Joined:
    Nov 15, 2009
    Messages:
    103
    Likes Received:
    3
    Possibly the ACTION_MEDIA_BUTTON ...

    Thread ...

    This part of the thread suggests that it is delivered to the foreground window as a regular key event.. what key it doesn't say. It also says that using the broadcast receiver approach may change in the future...
     

Share This Page

Loading...