Background: I have a A2DP/AVRCP bluetooth headset (Nokia BH-505) which I use actively to listen to both podcasts and music. Of course, I listen to these with different apps. The bluetooth headset has some "command" (AVRCP) buttons, relevant to audio - in specific: "next track", "previous track" and "play/pause"
Currently whenever I press any of the commands, one of the music players I have installed (Meridian) always gets the command - even when it's not active. So when I click "play/pause" intending to pause a podcast (DoggCatcher), instead Meridian is activated and starts playing music along with the podcast.
Both players are set to be using the headset: DoggCatcher has "Bind to headset" turned on, and Meridian has "Headset Buttons" turned on. I'm currently using unrooted stock Android 2.2.1 on GT-S5570 but may be rooting and upgrading to 2.3 CyanogenMod (or such), in future.
Ignoring the specifics, my question about this is more general:
- How does Android determine which app gets to react to these commands? I'm interested even in a very techincal answer.
On the practical side I'm interested in:
- Do I have to fiddle with each applications settings to determine which application takes the commands, or is there some general way of determining this?
- Is there a way to configure this so that the application that's actually active would automatically always get the priority? (as was asked partly in another question)
How this question differs from similar questions:
"How to Set 'Play' Button Behavior on Bluetooth Remote" - only practical, different focus, so far has no answers, and I'm also interested in answers that would require rooting or custom firmware (especially CyanogenMod).
Change default application for handling headset controls - an exact issue that got fixed, the but not in a way that would answer my questions, though it does gives some hints as to how things work.
How can I make the button on my headphones control something other than the stock music player? - partly similar question on practical side, but no focus on explaining how it actually works, and the only answer is focused on the part I'm not asking about (making only one app receive the commands).
why do all sound apps get bluetooth button events, all at once - very similar, but asking about a specific issue (all of the media players getting the AVRCP command)