Skip to content

Commit

Permalink
Use compact actions only before Android 13.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Sep 8, 2023
1 parent aaa7911 commit bd1c1e1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,10 @@ private Notification buildNotification() {
builder.addAction(action);
}
final MediaStyle style = new MediaStyle()
.setMediaSession(mediaSession.getSessionToken())
.setShowActionsInCompactView(compactActionIndices);
.setMediaSession(mediaSession.getSessionToken());
if (Build.VERSION.SDK_INT < 33) {
style.setShowActionsInCompactView(compactActionIndices);
}
if (config.androidNotificationOngoing) {
style.setShowCancelButton(true);
style.setCancelButtonIntent(buildMediaButtonPendingIntent(PlaybackStateCompat.ACTION_STOP));
Expand Down Expand Up @@ -772,7 +774,7 @@ private void releaseMediaSession() {
* Gets called from background thread.
*/
synchronized void setQueue(List<MediaSessionCompat.QueueItem> queue) {
this.queue = queue;
AudioService.queue = queue;
mediaSession.setQueue(queue);
}

Expand Down

0 comments on commit bd1c1e1

Please sign in to comment.