Search code examples
androidfirebasefirebase-cloud-messaging

Android notification has a color icon instead of being turned white


My Android app uses Firebase Cloud Messaging for notifications. When notifications come in, the icon isn't turned white like the other icons.

enter image description here

I'm using targetSdkVersion 23.

I have this in my manifest:

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

With a PNG file at android/app/src/main/res/drawable/notification_icon.png.

How can I get the icon to behave normally?


Solution

  • As suggested by Will Jones, the solution was to use a SVG file and convert it to XML using this: http://inloop.github.io/svg2android/. I then copied the file to android/app/src/main/res/drawable/notification_icon.xml and deleted the old PNG file.

    The icon now renders properly.