1. Check out our companion app, Forums for Android! Download from Google Play

Getting headphone button push event

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

  1. diegoesp

    diegoesp Member
    Thread Starter
    5

    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
    46

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