diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f14e30cb097..52af28a0478 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -81,6 +81,8 @@ ([#233](/~https://github.com/androidx/media/issues/233)). * Make `QueueTimeline` more robust in case of a shady legacy session state ([#241](/~https://github.com/androidx/media/issues/241)). + * Fix a bug where notification play/pause button doesn't update with + player state ([#192](/~https://github.com/androidx/media/issues/192)). * Metadata: * Parse multiple null-separated values from ID3 frames, as permitted by ID3 v2.4. diff --git a/libraries/session/src/main/java/androidx/media3/session/MediaNotificationManager.java b/libraries/session/src/main/java/androidx/media3/session/MediaNotificationManager.java index 27c0cc4ece6..30afcb411b8 100644 --- a/libraries/session/src/main/java/androidx/media3/session/MediaNotificationManager.java +++ b/libraries/session/src/main/java/androidx/media3/session/MediaNotificationManager.java @@ -219,9 +219,11 @@ private void updateNotificationInternal( if (startInForegroundRequired) { startForeground(mediaNotification); } else { - maybeStopForegroundService(/* removeNotifications= */ false); + // Notification manager has to be updated first to avoid missing updates + // (/~https://github.com/androidx/media/issues/192). notificationManagerCompat.notify( mediaNotification.notificationId, mediaNotification.notification); + maybeStopForegroundService(/* removeNotifications= */ false); } }