Push color instead of icon when app is opened


Hello @Ionic community !

I’m facing a problem with notification icons with firebase : when the app is in background, notifications are displayed with custom icon as desired ; but when the app is opened, a color is displayed instead of the icon.

My config.xml file :

    <platform name="android">
        <resource-file src="resources/android/notification/drawable-hdpi/ic_stat_app.png" target="app/src/main/res/drawable-hdpi/notification_icon.png" />
        <resource-file src="resources/android/notification/drawable-mdpi/ic_stat_app.png" target="app/src/main/res/drawable-mdpi/notification_icon.png" />
        <resource-file src="resources/android/notification/drawable-xhdpi/ic_stat_app.png" target="app/src/main/res/drawable-xhdpi/notification_icon.png" />
        <resource-file src="resources/android/notification/drawable-xxhdpi/ic_stat_app.png" target="app/src/main/res/drawable-xxhdpi/notification_icon.png" />
        <resource-file src="resources/android/notification/drawable-xxxhdpi/ic_stat_app.png" target="app/src/main/res/drawable-xxxhdpi/notification_icon.png" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />

Icons were generated with : https://romannurik.github.io/AndroidAssetStudio/icons-notification.html

The icon name is mentioned in notification data as below :

  var message = {
    notification: {
      body: event.messageBody,
      title: event.messageTitle
    android: {
      notification: {
        body: event.messageBody,
        title: event.messageTitle,
        sound: 'default',
        icon: 'notification_icon',
        color: event.notificationColor
    token: registrationToken

I thought about custom CSS, Android manifest configuration… but did’nt find anything. Does someone has an idea ?

Thanks ! :wink:


When the app is in foreground, it is its responsability to handle notification. I used FCM ionic plugin and handle push notifications directly. Problem solved.