I have a small problem with my Android app. It received notifications through FCM and shows them as push notification. So far it is all working, but the strange problem is, sometimes the icon is white and sometimes it is colourful.
When the app is open on the screen and I receive a push notification in this moment, the colourful push notification is shown on top of the screen.
When the app is closed, I get a push notification with a white icon.
I have attached a screenhot: Screenshot
Here is the code snippet, where the push notification is created:
Notification.Builder notificationBuilder = new Notification.Builder(this)
.setSmallIcon(android.R.drawable.ic_dialog_alert)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
.setAutoCancel(true)
.setVisibility(Notification.VISIBILITY_PUBLIC)
.setPriority(Notification.PRIORITY_HIGH)
.setColor(Color.parseColor("#83c3ed"))
.setLights(Color.RED, 1000, 500)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
inboxStyle.setBigContentTitle("WetterApp");
inboxStyle.addLine(notification.getTitle());
inboxStyle.addLine(notification.getBody());
notificationBuilder.setStyle(inboxStyle);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
My mobile device has Android 6.0.1, my SDK-version is 23.
Thanks for your help.