Closed 12people closed 7 months ago
When the media is being played back, the media notification can be swiped away and
onNotificationDeleted
isn't called. The media keeps playing, even if the foreground activity is gone.
Well of course it isn't called, because that method doesn't even exist in your purported reproduction project. It's an invalid bug report. Please update your bug report as per the instructions.
@ryanheise The example uses BaseAudioHandler
, which has this onNotificationDeleted
method:
@override
Future<void> onNotificationDeleted() async {
await stop();
}
So stop()
should be called, shouldn't it?
Either way, explicitly adding this to AudioPlayerHandler
in the example yields the same result:
@override
Future<void> onNotificationDeleted() async {
await _player.stop();
}
If I'm doing something wrong in the bug report, please tell me what it is.
Thanks for clarifying, so your steps to reproduce are to observe that after swiping away the notification, the media doesn't stop. This used to work pre Android 12, I suspect that what you're dealing with is that since Android 12, media notifications became persistent. You can't really swipe them away anymore, you can just cycle through the media notifications in the carousel. Even after a complete reboot, all of those media notifications will still be there. If you hide the carousel, it comes back after closing and opening the notification drawer.
@ryanheise Oh, now I see what you mean. I swiped away the notification and it seemed to be gone for good, BUT it turns out that there's another notification in the quick settings area (where I didn't even think to look). That's some terrible UX on the part of Android 13, because the second hidden quick settings audio player is not easily discoverable. That's very much related to my other report at https://github.com/ryanheise/audio_service/issues/1065 — could there perhaps be a way of not allowing the media notification in the notification drawer to be swiped away (even though there is a duplicate media player in quick settings)?
Closing, as it seems like a limitation on Android's part.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.
Documented behaviour
onNotificationDeleted
:Handle the notification being swiped away (Android).
Actual behaviour
When the media is being played back, the media notification can be swiped away and
onNotificationDeleted
isn't called. The media keeps playing, even if the foreground activity is gone.Minimal reproduction project
Official example: main.dart
Reproduction steps
Output of flutter doctor
• No issues found!