Notification icon is not displaying the app icon, this issue is only in android 12.
My code:- Notification method:-
Intent intent = new Intent(this, FragmentController.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
/*PendingIntent.FLAG_ONE_SHOT*/ PendingIntent.FLAG_IMMUTABLE);
String channelId = "Notification channel ID";
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.logo_round)
//.setSmallIcon(R.mipmap.ic_launcher_new_logo_round) //<- this not working
.setLargeIcon(BitmapFactory.decodeResource(PushNotificationService.this.getResources(),R.drawable.logo_round))
.setContentTitle(Title)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Since android Oreo notification channel is needed.
NotificationChannel channel = new NotificationChannel(channelId,
"Channel human readable title",
NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
Android manifest file:- (Under application tag)
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/logo_round" />
These answers are not helping: Android Push Notifications: Icon not displaying in notification, white square shown instead
and
How to set the app icon as the notification icon in the notification drawer
