1

I'm using MediaStyle notification. the notification symbol (smallIcon) isn't displayed in Android >= 11 when MediaStyle is enabled.

As I disable MediaStyle, then the symbol is shown. Permissions are set:

 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>



NotificationCompat.Builder builder =
   new NotificationCompat.Builder(mContext, CHANNEL_ID);

builder.setContentTitle("title")
    .setContentText("context")
    .setSubText("text")
    .setBadgeIconType(NotificationCompat.BADGE_ICON_LARGE)
    .setLargeIcon(iconLarge)
    .setContentIntent(pIntent)
    .setColor(ContextCompat.getColor(getInstance().getmContext(), R.color.lightColor))
    .setSmallIcon(R.drawable.notification_transparent)
    .setDeleteIntent(MediaButtonReceiver.buildMediaButtonPendingIntent(context,PlaybackStateCompat.ACTION_STOP));

builder.addAction(...1...);
builder.addAction(...2...);
builder.addAction(...3...);
builder.setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
    .setShowActionsInCompactView(0,1,2)
    .setMediaSession(mMediaSessionCompat.getSessionToken()));
mNotificationManager.notify(NOTIFICATION_ID,builder.build());

Thanks,

GGK

0 Answers0