3

I have a bluetooth headset which is able to communicate with my phone. It has one large 'call' button which answers/ends calls.

I am trying to make an app which will be able to intercept when the call button is pressed. I have tried using an intent filter:

<receiver android:name=".MediaButtonIntentReceiver">
    <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
    </intent-filter>
</receiver>

but the call button does not appear to be classified as a media_button

any ideas on how I can achieve this? I would just like to know when the call button is pressed

Roger Jarvis
  • 434
  • 5
  • 20
  • Have you read this answer: http://stackoverflow.com/a/10147953/1267661 ? – Sam Jun 21 '12 at 23:00
  • Yes, didn't help unfortunately. I can detect 'play' buttons from a wired headset using that code, but not from my bluetooth – Roger Jarvis Jun 21 '12 at 23:10

2 Answers2

0

try

android.intent.action.CALL_BUTTON

http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL_BUTTON

I'm not sure about it.. I think it fires for all call buttons, including any physical call buttons on the phone and buttons on the headsets .etc.

Madushan
  • 6,977
  • 31
  • 79
0

If the button is currently bringing up the Voice Dialer (mine does), you want ACTION_VOICE_COMMAND. Add the following to your intent filter:

<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
Alice Purcell
  • 12,622
  • 6
  • 51
  • 57