Questions tagged [media-buttons]
17 questions
14
votes
1 answer
Android "O" (Oreo, 8) and higher media buttons issue
The code for handling media buttons from headsets that I use in my Text-to-Speech app works great under Android API 22 through 25 (in older versions of Android they are handled by other, now depreciated means). However under Android 8 "Oreo", both…

gregko
- 5,642
- 9
- 49
- 76
7
votes
0 answers
Handling Android bluetooth headset buttons
This topic pops up sometimes but i can't have that thing working. My app used to handle media button, but API after Android 5.0 changed and it need to adapt this app to "catch" bluetooth buttons and handle them "my way".
I've done a lot of searching…

Jarek Kożdoń
- 336
- 2
- 13
4
votes
0 answers
Handle Media Button from Service in Android 8.0+?
i'm trying to handle the headsethook from a service in Android to start an action for my app, using MediaSessionCompat class, that it's different from the Media Player purpose.
Now, i wrote this code that work in Android 7 and below, but not with…

Vale Paw
- 41
- 2
3
votes
0 answers
On Android 13, Bluetooth headset buttons Next/Previous or FF/Reverse don't work when playback paused
In my own app on Android 13 (Pixel 6 Pro), that is similar to media players, the Play/Pause button from the Bluetooth headsets works normally, but recently I noticed, that the Next/Previous buttons, or FF/Reverse, don't work when playback is paused.…

gregko
- 5,642
- 9
- 49
- 76
3
votes
2 answers
MediaButtonReceiver not working when app is in background
I employed this guide to add MediaButtonReceiver feature to my media player app.
It works well so far the app is in forebackground, but as soon as the app enters background it stops receiving media button actions.
Part of manifest

X09
- 3,827
- 10
- 47
- 92
2
votes
1 answer
ACTION_MEDIA_BUTTON not working in BroadcastReceiver
This is a follow on question from an earlier one of mine here.
I am using android sdk 26 on a Samsung Galaxy S7 running Android v8 and am trying to use the play/pause button (HEADSETHOOK, keycode 79) on the earphones. Following suggestions from…

Doug Conran
- 437
- 1
- 5
- 17
1
vote
0 answers
Kotlin media player notification buttons do not take any action
I'm trying to develop a music playback application in kotlin as a foreground service with android studio but I'm having some problems with the notification buttons: I can't assign them a function on music playback.
Here's how I did it:
I created a…

Benoui Maisnon
- 11
- 1
0
votes
0 answers
Handle media button actions manually in media3
How can I manually handle media button actions with Media3 in a peaceful and compatible way without using MediaSessionConnector?
Previously, I used to handle media button commands using MediaSessionConnector and MediaSessionCompat, but due to…

imansdn
- 968
- 1
- 7
- 17
0
votes
0 answers
BroadcastReceiver for ACTION_MEDIA_BUTTON not working for api level 30
For Api Level 30
I want to build app that show toast message when user press headset button
Below are my main code
FOR BroadcastReceiver
public class headSet extends BroadcastReceiver {
@Override
public void onReceive(Context context,…

RAM KUMAR
- 13
- 2
0
votes
0 answers
Media Buttons Reciever not working properly in Android Kotlin
I have a music service class in my media player app that also shows notifications and handle media buttons from the headphone. But when I enable the next and previous media buttons, It does not respond to the Play Pause button and vice versa. This…

ShahZaman Rai
- 85
- 10
0
votes
2 answers
AndroidManifest.xml "Unresolved package" Error
I am developing a Media Player app. I was implementing MediaButtonReceiver (which is used to control Media inputs given from Headphone, bluetooth like external devices).
But while declaring receiver in the manifest file I encountered a number of…

Fardeen Khan
- 55
- 1
- 6
0
votes
1 answer
ACTION_MEDIA_BUTTON Receiver not Called after trying almost everything I could
I want to call a function when MEDIA_BUTTON is clicked. But in extended BroadcastReceiver class Constructor is called but onReceive function is not called.
I have test this over a BluetoothDevice as it has no affect. by this
Content in Manifest.xml…

Abdullah Omer
- 53
- 9
0
votes
1 answer
Fail to catch android.intent.action.MEDIA_BUTTON
My app that uses TextToSpeech to read some text is 90% finishes but has been stuck at this part for a few days. All I want is have the play/pause button of my bluetooth headset (Xiaomi's Mi Sports Bluetooth Earphones) to play/pause the TextToSpeech.…

Wakeman
- 103
- 7
0
votes
1 answer
Use MediaButton to control foreground app (no audio) with audio in background
I want to use the media buttons to control a foreground app, but not for audio use.
So the goal is to detect button clicks to do certain things in the app.
I can achieve that by using MediaSession and the MediaButtonReceiver. see here
The problem is…

cwiesner
- 934
- 1
- 8
- 24
0
votes
1 answer
Launch an android application using by hardware button press
Thank you for reading my question and please don't mention the older answers because I went through every bit of old ones in here that nothing work out. And I tried to find something from Responding to media buttons in android developer…

Savin
- 47
- 11