Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to capture a bluetooth headset button press

For now, I just want to display a "button pressed!" message when I press any button (volume or the call button) on a paired bluetooth headset (LG HBM-770). I've tried the exact method here (this is the code I'm using): Android - registering a headset button click with BroadcastReceiver with no luck, including the suggested fixes. Hours of google searching only point to that type of code. Bluetooth permission is enabled in the manifest.

If I press the call button now, it seems to never get to my app, instead it brings up the menu that asks you to choose which app to handle it (voice search, google voice, etc). If I hold down the bluetooth call button, my phone calls the last dialed number. If I try to replace the Intent filter type with ACTION_POWER_DISCONNECTED, it works flawlessly when I disconnect power, so it seems that the code from that point on works fine.

It would be nice if I could use no filter at all, and just have a Toast pop up displaying the ID of ANY action received, so I know what exactly the buttons look like to the phone.

like image 486
user1817205 Avatar asked Nov 12 '12 04:11

user1817205


1 Answers

Prssing call button on bluetooth headset will trigger certain AT commands(check in Hands Free Spec) to phone which phone will take care, ex: when pressed call button for long duration, headset will send an AT command for call redial and so are the other usecases.

Intents and the methods provided in the link are for the button pressed on the phone.

like image 143
ashish Avatar answered Oct 23 '22 10:10

ashish