[FIXED] How to set a Flutter Custom Notification Icon ?,because there is no default notification icon in flutter for fcm

Issue

I want to set a custom notification icon to appear in my notifications panel for my flutter app when i use fcm(firebase cloud messaging) but there is only a grey circle that appears and no icon .

Solution

After Searching for a long time i finally found the answer and here it is:

  1. Create a custom notification icon using this tool.
  2. Paste the generated list of icons in android/app/src/main/res.
  3. Go to your manifest android/app/src/main/AndroidManifest.xml and add the following meta data in the application (not activity) tag:
<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_notification" />
<meta-data
    android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/colorPrimary" />
  1. If you don’t have a colors.xml in res/values, create one:
    enter image description here
  2. Done! It should work, let me know if it doesn’t.

Discussion for the question is here.

Answered By – austin

Answer Checked By – Gilberto Lyons (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published