Why is my notification icon not displayed properly in Oreo?

Viewed 6308

We have notifications in our app since a long time, which work fine. I have a small, multicoloured .png-icon we use for them, that have worked fine in the past.

In Oreo, the icon is not displayed properly, it is just a grey square. Looking at the drawer on the device, it seems that the system, gmail etc. all now have single-colour icons, so i suspect that it has something to do with that.

However, i can't find any documentation, design guidelines or anything that confirm this, so i am surrendering to a question here...

How can i make my icon display as normal in Oreo? What am i missing?

This is how i create the icon, from what i can see in documentation it should work, and it works pre-Oreo:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context);

builder.setAutoCancel(true).setContentTitle("Title").setWhen(when)
.setContentText(message).setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon("icon.png").setContentIntent(contentIntent);

getNotificationManager(context).notify(NOTIFICATION_ID, builder.build());
1 Answers

refer this site In this site you may see this

You can see that I have set different small icons. Small icon need to be vector icon on Lollipop and upper Android versions. Otherwise it will show colored dot only as small icon.

If you have png,jpeg,jpg image file then convert it to svg and import this svg file into android studio using "Vector Asset" option and you are ready to go!!

Related