Reputation: 781
Although I did this solution which is in stackoverflow, the icon still the same.
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_launcher" />
here top icon:
and when I slide top bar, I see this:
Where is the problem? I also use this website for creating transparent icon: https://jgilfelt.github.io/AndroidAssetStudio/icons-notification.html#source.space.trim=1&source.space.pad=0&name=ic_stat_ic_launcher
Also my res file like this right now (drawable folders from above link):
Upvotes: 6
Views: 8246
Reputation: 555
For those who could not understand the notification icon requirements let me break them down.
Let's consider notification icon facebook which is white 'f' with blue circle on the background. Now for the notification icon make the 'f' transparent from the icon and generate the notification icon using asset manager
in android studio. You will notice the blue background is is transparent and 'f' is white now rest is same place the drawable generated folders in there appropriate folders.
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/app_icon" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/facebook_blue_color" />
that's it.
Upvotes: 0
Reputation: 129
I downloaded this package wich generate launcher icons autuomatically and it works perfectly
https://pub.dev/packages/flutter_launcher_icons
Upvotes: 1
Reputation: 404
In my case, the issue was that I was placing the
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" … />
tag under the main <activity/>
tag in the AndroidManifest.xml
Apparently, it should be under the <application/>
tag (higher in the hierarchy).
Upvotes: 12
Reputation: 426
The icon to be used for notifications must be white-colored and with transparent background else it will show a grey-colored box.
You can check out this article to know more.
I had the same problem and resolved it by making changes to the icon image.
Upvotes: 6
Reputation: 566
Have you tried changing the manifest line to this:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_stat_ic_launcher" />
From your screenshots it appears you only have the ic_stat_ic_launcher files in different resolutions.
If you want to use the mipmap/ic_launcher file, you'll need to add the different size files to the other mipmap folders (in the same way you have the mipmap/launcher_icon.png files), otherwise it probably won't find which file to use
Upvotes: 0