Android Question Detect media button use on BT earbuds

gunnarjonsson

Member
Licensed User
Longtime User
Hi All!
I have an app for Internet radio that also plays downloaded files. I use Exoplayer for this and it works perfectly. I recently bought BT earbuds and noticed that I need to be able to control the play and pause functions in my app from the mediabutton on the earbuds. I have searched the forum and tried many of the ideas but unfortunately I have not been able to make it work.
Have someone found a solution to this that works for recent Android versions?

Gunnar Jonsson
 

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
You should think differently in this case, the bt earbuds buttons interact with android os, not directly with audio player program, so you search about INTENTS.
In your case use ACTION_MEDIA_BUTTON and others related intents.
What is intent? you can search this forum with alot of info, this one explanation
 
Upvote 0

gunnarjonsson

Member
Licensed User
Longtime User
I have tried your app and it works with my BT earbuds. I can however not use it with downloaded files since it is only for streaming media.
Gunnar Jonsson
 
Upvote 0
Top