Angelina
Angelina

Reputation: 1573

FCM Custom Notification Icon not displayed

I have created white/transparent PNG notification icons and added them in application meta-data in AndroidManifest as per the manuals.

The strange thing is that the custom icon is displayed correctly on Samsung Mini (jelly bean) and Nexus 4 (API 27) emulator, but not on Samsung A6 (Oreo) and Huawei Honor Lite 9 (Oreo) devices where I see the default white droid on green background icon.

The notification is always displayed but on some devices the custom icon is not used.

I tried to implement it in AssetStudio and also implemented with and without Notification Builder but it had not effect.

Upvotes: 1

Views: 6860

Answers (4)

Ronny Bigler
Ronny Bigler

Reputation: 724

set this to your application tag in Manifest:

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

Upvotes: 0

Pavit Singh
Pavit Singh

Reputation: 1

Create a transparent icon. To test download any png , colorAccent is #ff7800 for my example

  • Add these lines in manifest.file

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

These changes will help in icon display.

Upvotes: -1

Angelina
Angelina

Reputation: 1573

The issue was solved by using the latest versions of Google Play and Firebase libraries. I had a slightly outdated Google Play version.

Upvotes: 0

Valery
Valery

Reputation: 1

For Oreo you need to implement notification channels: https://developer.android.com/training/notify-user/channels

Also you should put default default_notification_channel_id inside the AndroidManifest: https://firebase.google.com/docs/cloud-messaging/android/receive

Upvotes: 0

Related Questions