1. Download our Official Android App: Forums for Android!

Apps Getting headphone button push event

Discussion in 'Android Development' started by diegoesp, Jan 16, 2010.

  1. diegoesp

    diegoesp Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    6
    Joined:
    Jan 4, 2010

    Jan 4, 2010
    6
    0
    5
    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
    Rank:
    None
    Points:
    46
    Posts:
    103
    Joined:
    Nov 15, 2009

    Nov 15, 2009
    103
    3
    46
    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...