user6712117
user6712117

Reputation:

Disable showing play queue in Notification.MediaStyle

How to make MediaStyle notification without play queue?

My notification declaration looks like this, I can`t figure out how to disable showing next tracks.

Notification notification = new Notification.Builder(this)
            .setPriority(Notification.PRIORITY_DEFAULT)
            .setVisibility(Notification.VISIBILITY_PUBLIC)
            .setCategory(Notification.CATEGORY_TRANSPORT)
            .setContentTitle(contentTitle)
            .setContentText(contentText)
            .setOngoing(isPlaying)
            .setShowWhen(false)
            .setSmallIcon(R.drawable.ic_notification_cover_default)
            .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.cover_example))
            .setAutoCancel(false)
            .setContentIntent(contentPendingIntent)
            .setDeleteIntent(deletePendingIntent)
            .addAction(createAction(R.drawable.ic_notification_skip_previous, "Rewind", ACTION_REWIND))
            .addAction(playPauseAction)
            .addAction(createAction(R.drawable.ic_notification_skip_next, "Fast Forward", ACTION_FAST_FORWARD))
            .setStyle(new Notification.MediaStyle()
                    .setMediaSession(mMediaSession.getSessionToken())
                    .setShowActionsInCompactView(1))
            .build();

notification screenshot

Upvotes: 0

Views: 244

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 199880

Adding a play queue is not part of the Android API for MediaStyle (you'll note on Nexus devices there is no play queue) and is a manufacturer specific customization. You'll need to check with the manufacturer themselves to see if they provide any additional library to control this behavior.

Upvotes: 2

Related Questions