j2emanue
j2emanue

Reputation: 62519

FCM - How to get icon to be valid?

I am sending a Firebase Cloud Messaging notification to my Android app, but the icon on the notification is not showing correctly. its on nexus I'm having the trouble (KitKat).

and im using the following sdk:

 minSdkVersion 19
        targetSdkVersion 24

The image (.png) is a logo I am pulling from the drawable folder and it looks like this:

enter image description here

But now when I use it in my notification it looks like this:

enter image description here

Keep in mind I am sending the notification using an API call like this:

https://fcm.googleapis.com/fcm/send

and the post body looks like this:

    { "notification": {
    "title": "Your Title",
    "text": "Your Text",
     "click_action": "OPEN_ACTIVITY_1"
  },
    "data": {
    "keyname": "some data item name "
    },
  "to":"eZm-5IM8dkE:APA91bFkC9kZSgZblDr_4JBB-MNOCkITsRGSECykFzXQE70zzM8rShP66pPYIX4iBio3V9sN1Go1q4o6dGhybm6SPRio3asC-6NIltzQfc0ZlmWrexxxxxxxxxxxxxxxiHygCx2y"
} 

I noticed I am not setting the icon anywhere, but I don't think that's the issue. Notice how its a parallelogram in both images, so I think its just processing it differently. What am I doing wrong?

also note in the Android Manifest, I have set the following:

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

Upvotes: 0

Views: 973

Answers (1)

Diego Giorgini
Diego Giorgini

Reputation: 12717

FCM is showing your icon correctly but Android (not FCM) is changing the icon color to white.

This is the standard behavior of Android and is documented here: https://developer.android.com/about/versions/android-5.0-changes.html#BehaviorNotifications
(see the last paragraph under Notifications > Material design style)

Upvotes: 1

Related Questions