3

I've been working with Android notifications and the notification icons are behaving differently on my two test devices (one with Android 9 and one with Android 11).

I set the notification icon to be the same as the app's launcher icon, like this:

notificationBuilder.setSmallIcon(R.mipmap.app_icon);

On Android 11, the icons in the notification bar show up exactly like the launcher icon, i.e., colorful (the first two icons are from apps developed by me):

Notifications o Android 11

On the other hand, Android 9 applies something like a boolean filter to the icons (here they are round because the launcher app on this phone applies an additional circle filter to the launcher icons):

Notifications on Android 9

After some research online, I only found information about how colors are not allowed in notification icons since Lollipop, and how what I am seeing on Android 9 is actually the expected behavior since then.

But what could explain the colorful icons showing up correctly on my Android 11? I assume that this may be a new feature from Android 10 or Android 11, but I couldn't find anything mentioning that in the documentation.

I would like to be sure of something like "colorful notifications icons are supported since SDK 30" (or maybe 29), so that I can set the icons depending on the device versions. More specifically, I would like to use the colorful icons on devices that support that, while using different single-color icons on devices that don't. But unfortunately I don't know for sure which devices/Android versions support it.

Thanks in advance.

0 Answers0