i have an audio book app that work without a problem until android 11. my problem is when i set mediasession to mediastyle, app media notification won't show anymore. i cant find the problem.
here is my code:
Notification notification = new NotificationCompat.Builder(this, channelId)
.setLargeIcon(Archive.Cover)
.setSmallIcon(R.drawable.ic_small)
.setContentTitle(Archive.getChapterTitle())
.setContentText(Archive.BookTitle)
.setOngoing(false)
.setShowWhen(false)
.setContentIntent(pendingIntent)
.setPriority(Notification.PRIORITY_MAX)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.addAction(generateAction(R.drawable.ic_replay_white_36dp, "Rewind", ACTION_REWIND))
.addAction(action)
.addAction(generateAction(R.drawable.ic_forward_white_36dp, "Fast Forward", ACTION_FAST_FORWARD))
.setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
.setMediaSession(mediaSession.getSessionToken())
.setShowActionsInCompactView(0, 1, 2))
.build();