title: How to capture key events from bluetooth headset with android
body: <p>My app can be controlled by normal headset. It simply overrides "onKeyDown". But key events from bluetooth headset are not captured - why? Or how to capture bluetooth key events?</p>
  
  <p>the "log cat" shows the following if i press button on headset:</p>
  
  <pre><code>Bluetooth AT recv(3043): AT+VGS=15
  AudioPolicyManagerBase(13654): FM radio recording off
  AudioService(2261): sendVolumeUpdate, isKeyguardLocked...Not to update Volume Panel.
  VolumePanel(2261): change volume by MSG_VOLUME_CHANGED
  VolumePanel(2261): onVolumeChanged(streamType: 6, flags: 0)
  VolumePanel(2261): Call setChangeSeekbarColor(false)
  </code></pre>
  
  <p>i also tried to handle media button actions but this isn't working. my idea is a free configurable key mapping: the user chooses "set key" my app hears on all keys (hardware, media buttons, bluetooth headset) then the user presses a key and the event/key code is stored in config.</p>
  
  <p><em>Summerizing not working Answers:</em>
  Volume buttons must be captured by "VOLUME_CHANGED_ACTION". The problem is this intents are broadcasted to other apps and abortBroadcast() doesn't work (it works only for "ordered" Broadcasts). Another problem is that keys on cable headset and on phone trigger onReceive() twice (why?) the bluetooth headset trigger it once.
  The next Problem is the 3rd key on Bluetooth headset. It triggers voice-command (s-voice starts on s3), i tried to capture many different intents regarding this but i can't "receive" this button press and don't know why.
  At the end i want capture all kinds of buttons and don't want them handled by other apps (like using onKeyDown and returning true).</p>