2

I´ve bought a Bluetooth headset (MOTOROLA HK200) with the intention to use the call button in a push to talk application. This way, with my application running, when I push the headset call button I want to start capturing and sending audio. However, when I push the call button for a long period of time, a new call is directly launched and Android prompts a dialog to choose the application I want to use to make the call (which is not what I want). I've already achieved something similar with a wired headset by capturing the event ACTION_MEDIA_BUTTON (1) but I don't get the same result with the Bluetooth headset call button.

I've been looking examples for a long time but I haven't found the solution.

Thanks for your help,

Community
  • 1
  • 1
Jafuentes
  • 365
  • 2
  • 6
  • 13

1 Answers1

1

Pressing headset for a long time issues a AT command to phone to redial the last number. I think its calls the BluetoothHandsfree.redial()(in packages/apps/Phone) method to call last call which is called when phone receives BLDN command(or maybe another AT command).

ashish
  • 1,384
  • 1
  • 12
  • 21
  • Yup, (re)dialing fires when the phone receives an ATD or AT+BLDN [command](https://stackoverflow.com/questions/17176162/how-to-handle-at-commands-from-a-bluetooth-headset-in-android/18657522). In latest android versions (I think after the switch to BlueDroid?) that has been moved to the bluetooth [stack](https://android.googlesource.com/platform/system/bt/) and [package](https://android.googlesource.com/platform/packages/apps/Bluetooth/) though. And the interaction with the phone app just happens through an `ACTION_CALL_PRIVILEGED` intent. – mirh Jun 01 '20 at 21:40