Notification icon on Android shown as a white square
Solution 1
I think you generated the icons of wrong size. I re-generated them using the android asset studio and seems to be working at my end. You can download then using this link:
Solution 2
Background of notification icon should be transparent From Android 5.0 Lollipop Notification icons must be entirely white.
Solution 3
I think you should checkout this. I also hat a lot of problems with that so I saved that answer to my bookmarks ;)
Comments
-
mvasco over 1 year
I am using Firebase Cloud Messaging with my Flutter app.
I am sending Push Notifications to my app using the Firebase Console.
My issue is regarding the notification icon on Android.
I have created an icon with Android Asset Studio, as follows:
Then I have included the downloaded assets into their respective folder at android/app/main/res/mipmap.
On Manifest I have included the needed meta-data code:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_stat_logopush" />
But when sending a notification, a white square is shown.
What am I missing or doing wrong?
Edit:
This my current file:
-
Milan Tejani over 2 yearsDoes this happen on every device or some devices?
-
CommonsWare over 2 yearsTry putting them in
drawable
directories, notmimpap
directories. AFAIK,mimpap
is only for launcher icons. -
mvasco over 2 years@CommonsWare, let me try your proposal
-
Alexander Hoffmann over 2 yearsIs the background actually transparent? Android will only use the outlines of your icon.
-
Nitish over 2 yearsYour image doesn't seems to be completely transparent , you need to make background transparent.
-
mvasco over 2 years@NitishChaudhary, I have created the image with a transparent background. How can I be sure that it is really transparent?
-
Nitish over 2 yearsWhat's the dimension of the image you are using , above attach image has a dimension of 512x512 which too large for notification. Can you reduce it to 24x24 , 36x36 and 48x48 for hdpi , xhdp and xxhdpi.
-
Nitish over 2 yearsTo check transparency you can use online editor - photopea.com
-
mvasco over 2 years@NitishChaudhary, it is transparent now, but the issue is there. I have downloaded the assets from Android Asset Studio with their end size depending on their respective drawable folder
-
-
snachmsm over 2 yearsnot necessary "must"... Android will exchange every not-fully-transparent pixel into solid white (or dk gray, depends on background color of status bar), only transparent ones will stay transparent
-
mvasco over 2 yearsThank you @Tarik, I think my icon is ok for that use. But may be not. I will add it to my question to be sure.
-
mvasco over 2 yearsThank you for your effort, I have downloaded your proposed link from Android Asset Studio, copied the respective drawable folders to res, and changed the AndroidManifest file including: <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_capenergy" />
-
mvasco over 2 yearsBut the same result with the notification icon
-
Nitish over 2 yearsIs your meta-data tag inside you application class tag?
-
Nitish over 2 yearsUse this link to confirm if image source has been added to correct places. link
-
mvasco over 2 yearsYes, I have followed exactly the given tutorial
-
mvasco over 2 yearsi know you are in the right way. I will try later from the beginning.Thank you for your time and effort.
-
Frank van Puffelen over 2 years@TarikHuber: if the entire answer is in that link, please mark the question as a duplicate.