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 .
Asked
Active
Viewed 2,585 times
1 Answers
9
After Searching for a long time i finally found the answer and here it is:
- Create a custom notification icon using this tool.
- Paste the generated list of icons in
android/app/src/main/res
. - 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" />
- If you don't have a colors.xml in res/values, create one:
- Done! It should work, let me know if it doesn't.
Discussion for the question is here.

Oleg Yablokov
- 736
- 8
- 19

austin
- 517
- 5
- 16
-
Little sidenote: The tool (Notification icon generator) names the icons sometimes in a strange way. To make the above configuration work, you need to rename every icon to ic_notification before you copy the icons into the ```android/app/src/main/res``` folder. Second point, to make the color work, rename the ```colorAccent``` in the colors.xml to ```colorPrimary```. That't is! – Chris Nov 16 '22 at 22:34