You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Media notification dismisses only on second swipe #2302
Swipe down from viewport to so you can see Media Notification
Press pause on it
Swipe notification away - instead of disappearing, it gets immediately recreated, and only now swiping away this recreated one it will be properly dismissed.
Expected result
Swiping away the media notification should not recreate it. It should be gone.
Actual result
The swiped notification gets recreated the first time it is swiped away.
I can confirm that the issue occurs on more Samsung devices, including the Samsung S24 (Android 14) and Samsung A52 (Android 14).
Regarding the reported behavior, I also noticed that if you are playing media content and close the application (removing it from the background), the notification remains on the device. Previously, this did not happen because the MediaLibraryService was completely stopped.
This is likely related to the release intent of the notification that doesn't fully remove the notification. Need to try out on a Samsung device still, but I can reproduce a similar effect on an older emulator.
close the application (removing it from the background)
What did you do exactly for this scenario? That feels like a different question unrelated to the ability to swipe away notifications.
A likely workaround is to convert the stop key event that is currently sent when the notification is dismissed to clear the playlist instead (or release the player) in your MediaSession.Callback:
Just for full disclosure - if your app has, let's say a custom mini player with play/pause buttons, and if you didn't have this workaround and after double swipe you go back to your app, you could press play on your custom mini player and the playback would start.
However, if you have implemented this workaround, then after swiping, going back to your app and pressing play on your custom mini player - nothing would happen, because now there is no playlist on the player. You have to emit some event, so your custom players would know "ah, have empty playlist in player, got to make myself hidden or something".
Activity
tianyif commentedon Apr 3, 2025
Hi @SandisPutnis,
This might be a Samsung specific issue as I couldn't repro this on Pixel, then we can hardly help on this I'm afraid.
SandisPutnis commentedon Apr 4, 2025
Note - the issue is only in
1.6.0. The1.5.1version works as intended.adelinolobao commentedon Apr 4, 2025
I can confirm that the issue occurs on more Samsung devices, including the Samsung S24 (Android 14) and Samsung A52 (Android 14).
Regarding the reported behavior, I also noticed that if you are playing media content and close the application (removing it from the background), the notification remains on the device. Previously, this did not happen because the MediaLibraryService was completely stopped.
tonihei commentedon Apr 4, 2025
This is likely related to the release intent of the notification that doesn't fully remove the notification. Need to try out on a Samsung device still, but I can reproduce a similar effect on an older emulator.
What did you do exactly for this scenario? That feels like a different question unrelated to the ability to swipe away notifications.
tonihei commentedon Apr 4, 2025
A likely workaround is to convert the stop key event that is currently sent when the notification is dismissed to clear the playlist instead (or release the player) in your
MediaSession.Callback:SandisPutnis commentedon Apr 4, 2025
I can confirm that the workaround works (if I return true).
However, is it possible to use it if app is written in Java?
A slight side-question, but still on the topic.
When I implement an override:
.. the compiler throws an error in line return
return MediaSession.Callback.super.onMediaButtonEvent(session, controllerInfo, intent):'androidx. media3.session. MediaSession. Callback' is not an enclosing classWhen other button events come in, I need to pass them further down the line to library, so I wouldn't have to handle them.
tonihei commentedon Apr 4, 2025
Yes, sorry, you can simply return false. Updated my snippet above.
SandisPutnis commentedon Apr 4, 2025
Ah yes, the override description explains it:
Thanks!
SandisPutnis commentedon Apr 4, 2025
Just for full disclosure - if your app has, let's say a custom mini player with play/pause buttons, and if you didn't have this workaround and after double swipe you go back to your app, you could press play on your custom mini player and the playback would start.
However, if you have implemented this workaround, then after swiping, going back to your app and pressing play on your custom mini player - nothing would happen, because now there is no playlist on the player. You have to emit some event, so your custom players would know "ah, have empty playlist in player, got to make myself hidden or something".
adelinolobao commentedon Apr 7, 2025
Forget the comment, another dev changed the code and I didn’t noticed
Remember explicit notification dismissal
tonihei commentedon Apr 10, 2025
The commit above fixes this issue. We'll include it in the next bugfix release.
Remember explicit notification dismissal
Remember explicit notification dismissal