I've setup push notifications in my flutter app using firebase and I'm trying to set the custom push notification icon, with a custom background color.
I've created a plain white png image with a transparent background, as required by the specs of Android Notification icons.
I've even created the Notification Icons within Android Studio itself, according to this.
What I cannot get to work, sadly, is the color that I want. I've added the following tags in my Android Manifest:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notif_icon" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/notif_icon_bg" />
and the notification icon is rendered perfectly, but the color behaves really weirdly. It seems to actually overlay my notification icon, and it's also never really the color I set for notif_icon_bg
. I've tried the following:
- #000000 > Renders in Grey
- #00FF00 > Renders in a somewhat paled out green
- #0000FF > Renders in Purple
- ....
I'm testing this on an Samsung Galaxy A15; is this somehow limited by the device? As said, the color of the notification icon seems to somehow overlay the entire icon, like a semitransparent overlay of the color I've provided in the examples after the '>' above. Why is this happening?
On the same device, I have whatsapp and instagram installed, and the background colors of their notification icons are perfect and do not overlay the notification icons, which stay perfectly white.
Why could this be happening???
I've also tried to use a random image that I generate in photoshop with two simple white rectangle shapes placed one next to the other, and then exported that as PNG with a transparent background. And again, blue is rendered in purple, etc. etc.
I've setup push notifications in my flutter app using firebase and I'm trying to set the custom push notification icon, with a custom background color.
I've created a plain white png image with a transparent background, as required by the specs of Android Notification icons.
I've even created the Notification Icons within Android Studio itself, according to this.
What I cannot get to work, sadly, is the color that I want. I've added the following tags in my Android Manifest:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notif_icon" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/notif_icon_bg" />
and the notification icon is rendered perfectly, but the color behaves really weirdly. It seems to actually overlay my notification icon, and it's also never really the color I set for notif_icon_bg
. I've tried the following:
- #000000 > Renders in Grey
- #00FF00 > Renders in a somewhat paled out green
- #0000FF > Renders in Purple
- ....
I'm testing this on an Samsung Galaxy A15; is this somehow limited by the device? As said, the color of the notification icon seems to somehow overlay the entire icon, like a semitransparent overlay of the color I've provided in the examples after the '>' above. Why is this happening?
On the same device, I have whatsapp and instagram installed, and the background colors of their notification icons are perfect and do not overlay the notification icons, which stay perfectly white.
Why could this be happening???
I've also tried to use a random image that I generate in photoshop with two simple white rectangle shapes placed one next to the other, and then exported that as PNG with a transparent background. And again, blue is rendered in purple, etc. etc.
Share Improve this question asked Mar 17 at 23:25 DevelJoeDevelJoe 1,3803 gold badges14 silver badges39 bronze badges1 Answer
Reset to default 0Apparently, this is a limitation of the platform Android itself, when the dark mode is enabled: https://github/MaikuB/flutter_local_notifications/issues/2469