androidfirebaseandroid-notificationsfirebase-cloud-messagingandroid-mipmap

FCM - When setting icon in meta data, should I use the mipmap folder?


To set a default icon with FCM we can add a meta tag in the Android manifest. Mine currently looks like below because I'd like to use my application's icon as the notification icon when receiving push notifications:

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

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

Notice I am getting ic_logo_launcher.png from the mipmap folder. Is this advisable?


Solution

  • Yes ! You can ...though firebase takes app_icon by default

    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@mipmap/ic_launcher" />
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/notificationBackground" />
    

    But its better to use icon from @drawable which will have alpha and white icon.