18

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:

11

media-button-router, already mentioned in one of your linked questions, tries to figure out what app is currently playing music and to dispatch the AVRCP events to it. In addition, it lists all apps installed, that declare to listen to AVRCP events.

What makes AVRCP complicated: Some apps, like Sony's Music Unlimited, seem not to declare android.intent.action.MEDIA_BUTTON in their manifest. For this (or maybe some other) reason they can't be controlled via media-button-router. I know that e.g. Music Unlimited can be controlled via AVRCP since I read it in a user comment and also I was able to get it running once but unfortunately it's not reproducable. So in those cases it seems that we have to wait for an app's update with a clean implementation of AVRCP event handling.

According to media-button-router's wiki "Media Button Intent handling is done through ordered broadcasts, and each app sets it's own priority for receiving." So maybe it could be possible to write an app that displays theese priorities and, in effect, would allow you to determine what application will start. However, I don't know about such an app.

1

They finally added a section to answer this exact question: https://developer.android.com/guide/topics/media-apps/mediabuttons.html

0

Perhaps this will help a bit:

Samsung S5 --> Bluetooth receiver + In Ear phone plugs

I am using Samsung S5, first with 7digital app to download and play music. Then I changed and used Cloudplayer. But every time while Clouplayer is playing and I press the pause/play button on my Bluetooth receiver my 7digital app will start to play music. I could not change any setting to change the bluetooth play/pause towards Cloudplayer. I then deleted all my 7digital downloaded music and tried again. Problem solved! Play / pause is somehow linked to Cloudplayer now.

0

It is not a problem with your BT device. When paired with you phone, Bluetooth Headset plays active A2DP stream initiated from Mobile Phone. If it is some standard media player on your phone, It can react to all AVRCP control commands like play pause skip, fw etc. Now when you play something on the web or some other player which does not implement all such controls over AVRCP, for BT Headset it is still an active A2DP stream coming. It will dispatch AVRCP Control messages to your phone. It is now your phone which is supposed to route these commands to the respective app in most cases to the active A2DP streaming source or in your case your phone is still forwarding AVRCP commands to the default music player.

Your best bet would be to try configure your mobile provided the source you are playing does support AVRCP control. If it does not then anyway you can't do anything. If it does, then definitivly Mobile should allow these AVRCP commands to be handled by your active A2DP streaming source.

-2

This app would be "Media Button Router" https://play.google.com/store/apps/details?id=com.harleensahni.android.mbr

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.