Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Firebase notification gives default icon

I have a problem with my Firebase notification icon. Until now it only shows a default android icon when I sent a notification. It looks like this:

https://i.stack.imgur.com/jbIpj.jpg

But that is not even an icon I use. I changed the icons multiple times in "Image assets" but it keeps comming up like this...

What am I doing wrong? Because the only thing I can find on the internet is that people get a gray icon instead of their own.

like image 351
Eric Osman Avatar asked Jan 04 '19 10:01

Eric Osman


People also ask

How can we get device token for Android for push notification?

To receive the Device Token (and updates to the token value) and push notifications, you must create a custom class that extends FirebaseMessagingService . The onNewToken callback fires whenever a new token is generated.


1 Answers

<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
     -->
<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_ic_notification" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
     notification message.  -->
<meta-data
    android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/colorAccent" />

Check this link for more details https://firebase.google.com/docs/cloud-messaging/android/receive

like image 175
Akash Patel Avatar answered Sep 20 '22 04:09

Akash Patel