Kevin
Kevin

Reputation: 59

How to set different icons for app and for its notifications?

I'm using a picture with black background and white sign as an icon for my app. The problem is when I'm getting a notification a icon at the top of the display is completely white (I don't know why to be honest, when screen is locked it looks as originally).

I want to solve this problem by setting different icon for notifications, I can use this site, when I'm using a text icon generated by this site it works just fine.

I'm wondering how to set different icons for my app and its notifications, I know it's possible, but I only have folders that are used for both app and notification icon (drawable-[hdpi/mdpi/xhdpi/xxhdpi/xxxhdpi]).

Upvotes: 1

Views: 2048

Answers (2)

Kevin
Kevin

Reputation: 59

Problem solved, I added below to AndroidManifest.xml (application section)

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/new_notification_icon" />

Upvotes: 1

Leon Lu
Leon Lu

Reputation: 9234

The problem is when I'm getting a notification a icon at the top of the display is completely white (I don't know why to be honest, when screen is locked it looks as originally).

You set the SetSmallIcon() in the Notification.Builder.

To understand the Android documentation which is as follows – “Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.”

you can convert your notification icon to an Android friendly one with a few clicks.

In Notification icon generator, open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white.

Upvotes: 1

Related Questions