Prior to Android 2.2
With these earlier versions of Android, it's a bit like the wild west. Each application fights to respond to the button events. Determining which application responds to the events is based on the priority declared by each application and can vary by device.
Starting with Android 2.2, developer API's were created to make it possible for applications to share the buttons events.
How it should work
The last application that was used to play audio, should be the one to receive and respond to button events. You can see this demonstrated by following these steps:
-Start DoggCatcher and press play in the DoggCatcher UI
-Press a headset button (wired or BT) a few times, DoggCatcher will responds to the button presses
-Start the Android music app and press play in the music app UI
-Press a headset button (wired or BT) a few times, the music app will responds to the button presses
We've followed the development guidelines and reproduced the intended behavior, and also the behavior of the Android music player.
In order to get DoggCatcher to bind to the buttons, you should connect your headset, start DoggCatcher, and press the play button in the application UI. From that point on DoggCatcher will become the 'preferred' application and will respond to the button presses.
To get another application to bind to the buttons, start the other application and press play in the application's UI.
How it should not work
If you play an audio file in the Android music app, and then press a headset button, and an app besides the Android media player responds to the button, then that app isn't following the developer guidelines properly. In this case, it's going to be difficult to get multiple audio apps to share the button events.
There are some apps in the Google Market that acquire exclusive binding to the media buttons (as of this post). While those apps are installed, no other apps will be able to receive buttons events. If your buttons stopped working around the time you installed a media application, it's likely to be the cause.
Headset button developer guidelines
The coding details can be found here - http://android-developers.blogspot.com/2010/06/allowing-applications-to-...