Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

The purpose of MediaButtonReceiver in Android API 21+

When handling mediaButton events originating from remote controls or headsets, the Android documentation states here: On Android 5.0 (API level 21) and higher, Android automatically dispatches media ...
tvanlaerhoven's user avatar
2 votes
0 answers
79 views

How do I control my own programmed kotlin wear os stopwatch app with the bluetooth headset buttons skip forward and skip backward?

I programmed a wear OS app in Kotlin (and Jetpack Compose). The app is a stopwatch app and therefore has a start function and a stop function. Previously, these functions were triggered using a touch ...
Mr. WTG's user avatar
  • 21
1 vote
1 answer
1k views

Responding to media button events: MediaSession vs. MediaButtonReceiver

As described on this documentation page: https://developer.android.com/guide/topics/media/legacy/media-buttons, the route a media button event takes depends on the Android version. On API versions 21+,...
tvanlaerhoven's user avatar
1 vote
1 answer
1k views

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 ...
imansdn's user avatar
  • 1,247
3 votes
0 answers
224 views

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, ...
gregko's user avatar
  • 5,782
0 votes
0 answers
277 views

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 ...
ShahZaman Rai's user avatar
0 votes
2 answers
830 views

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 ...
Fardeen Khan's user avatar
1 vote
1 answer
793 views

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 ...
Abdullah Omer's user avatar
1 vote
1 answer
2k views

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 ...
Wakeman's user avatar
  • 143
0 votes
1 answer
404 views

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 ...
cwiesner's user avatar
  • 952
0 votes
1 answer
351 views

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 ...
Savin's user avatar
  • 47
7 votes
0 answers
608 views

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 ...
Jarek Kożdoń's user avatar
4 votes
0 answers
881 views

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 ...
Vale Paw's user avatar
0 votes
0 answers
490 views

How to customize the add media button, popup with my custom html in the popup window after clicking the button in wordpress

I have the below code. I need a button like add media in the edit page of admin, in which on click shows a popup and displays my custom html with a form in it. I tried with below but I am getting the ...
user3326941's user avatar
2 votes
1 answer
988 views

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) ...
Doug Conran's user avatar
3 votes
2 answers
6k views

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 ...
X09's user avatar
  • 3,916
0 votes
1 answer
116 views

How to capture Media Buttons while screen is locked?

I am trying to figure out how apps like Spotify capture headsetbutton presses while the screen is off or locked. I am currently able to catch button presses with my class HeadSetActionButtonReciever, ...
thelastchief's user avatar
15 votes
1 answer
6k views

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 ...
gregko's user avatar
  • 5,782