Reputation: 16988
I'm not sure how to get started here so I'll ask a fairly general question.
Let's say I have a plug-in headset with a button. Now if I have an incoming phone call, can I programmatically make it so that when the user clicks the button on the headset, it answers (or rejects) the call? I can already register the headset clicks so that's not an issue. Also eventually I need to do a multitude of functions such as play/pause music with the button (if the music player is open).
Mostly I'm just looking to be pointed in the right direction. Thanks.
Upvotes: 1
Views: 1912
Reputation: 1028
The built-in Phone and Music app already support media buttons(headset button) and have the similar behavior.
If you want your app to be the sole receiver of media button events: AudioManager.registerMediaButtonEventReceiver
Upvotes: 2