Well, I guess, the behaviour of the ACTION_MEDIA_BUTTON is not to only start or stop playing music.
Different apps might want to handle and do different stuff when the media button is pressed, and thus, every app registered for the broadcast should receive it silently, without prompting the user, since, different apps might do different things. I think, registering for this broadcast should be done within one of your activities or services where you want to listen to this broadcast and also unregister it when you are done, instead of putting this in your manifest. On Thu, Nov 11, 2010 at 11:14 PM, michael <[email protected]> wrote: > Thanks for the reply. So I guess Android is missing a clean concept > here...? > > The problem is that if a user has installed several media (e.g. music) > players, it is not clear which player will be started. Most likely, > all of them are registered for the ACTION_MEDIA_BUTTON intent, and > hence all of them might start playing music... If the players abort > the broadcast once received, I guess the other players won't receive > it anymore... But still, there is no possibility for the user to > choose which player should take control. I've noticed that some > players just set an extremely high priority value for the intent (and > thus basically try to make themselves the default player). This is > definitely not the intended way of handling the issue, because in the > end, only the user can decide which of two installed players should be > launched (i.e. which one s/he wants to be his/her default player, and > which one might be used for special cases only). > > Any thoughts on that? > > > On Nov 11, 4:14 pm, Mark Murphy <[email protected]> wrote: > > The media button is a broadcast Intent, not an activity Intent. Hence, > > it doesn't go through the normal chooser-style stuff like you see with > > activity Intents (e.g., default browser). > > > > You can listen for the ACTION_MEDIA_BUTTON broadcast. The > > documentation does not say it is an ordered broadcast, so I assume all > > applications that have registered for it will receive it. > > > > > > > > On Thu, Nov 11, 2010 at 10:06 AM, michael <[email protected]> wrote: > > > Hi, > > > > > I wonder whether there is a concept in Android that allows a user to > > > define which application should be launched if a headset media button > > > is pressed..? > > > > > This would be something similar as the concept of a "default browser" > > > or "default e-mail application" that is launched when a website should > > > be opened or a mail needs to be sent. As far as I know such a concept > > > at least exists for a browser on Android. > > > > > Is there something like a "default media player" that is started when > > > the user hits the headset's play button? If so, how could my > > > application inform the system that it is a potential candidate for the > > > "default media player" application? > > > > > Thanks, > > > > > Michael > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy<http://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twitter.com/commonsguy> > > > > Android App Developer Books:http://commonsware.com/books > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

