-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grey square as icon notification android #730
Comments
Same problem here. How can we fix it? |
This is probably related to #177 To fix this, you'll have to move the notification icon from the drawable folders to the mipmap folders. Hope this will help you. |
You need to:
Your asset dimensions (in pixels): |
Looks like @wuppious was correct in having them in both folders as that seems to have solved my issue for notification icon images in android builds before 5.0 (Lollipop). Unfortunately though now android phones with version 5.0 (Lollipop) and higher now display a grey notification icon which is where @hannigand your suggestion works. Although I still needed them in the mipmap folder to get them so show up properly which is odd. Has anyone found a solution for swapping icons based on the android version? I'm also noticing that even though I have the transparent ic_notification.png in both folders my app still ignores those files and uses the ic_launcher.png files instead. Any further suggestions? |
My suggestion was to move the icons from drawable to mipmap, not include them in both directories. I have my icons working on all versions, so maybe having them in both folders breaks it for you? |
Ah I misread my apologies. So I did as you suggest @wuppious but even though my ic_notification file is white on transparent the app uses the ic_launcher file instead of the ic_notification icon. Making the ic_launcher file white on transparent png works but obviously that breaks my actual app icon, plus that's not the functionality I want as I want the ic_launcher image to have color. |
Looking at my own projects, I can safely say it shouldn't be an issue, since I have the icon in both folders. Would you mind sharing the code that creates the notification? |
@wuppious, ok so just tested on two physical phones. They both default to using the ic_launcher as their notification icon but phones with version 7.0 actually displays the ic_launcher icon with color while phones with android version 8.0 display a grey icon.
|
And this is the code I'm using to initialize my notifications.
|
Do you use this library for local notifications? When creating/scheduling a notification, you can specify the icon being used ( |
Unfortunately no, I'm using it for remote notifications only at the moment. I'll keep on digging though, thanks for the help! |
@Diego-F-Aguirre Have you found a solution? I am experiencing the same issue when receiving remote notifications (local notifications display the right icon) |
@hannigand 's suggestion solved it for me. (Moving the icons to the mipmap folders and calling them This should probably be in the documentation somewhere if it isn't already. |
@hannigand thank you. I replaced icons and after reinstall an app it works! |
I've fixed it on my app by ensuring
using the image name 'ic_notification.png' and also ensuring your GCM data has this property:
|
You have to follow some rules for notification icon link. |
What are the rules you have to follow exactly for the notifications icon? The link you supplied is just general info for all icons re: Material Design. |
Hi @bobber205, |
still not working :/ |
My case was a little bit contra intuitive. I assumed the default_notification_icon would also work for the local background notifications but it doesn't. The default notification icon defined in In our case we had to add Android specific call to the Example:
If you named your icon differently than Hope it helps someone else. |
So I've been using the wix react-native-notifications library to display my notifications. Turns out they chose to write custom code to completely override whatever you set in your metadata! I discovered this by searching for So the solution is to create 1 icon which is transparent + white color and put it in as I can't believe somebody would write a confusing piece of code like this but that's the horrors of open source for you :/ |
I flowed the orientation of @hannigand and I could fix the grey square. But now I have a blue small icon in my notification. In the status bar the icon is white. Does someone know how to set the color of the small icon in the notification? I have in my Manisfest:
My icon is a white logo with a background transparent and I have inside mipmap folder with ic_notification.png name. |
for the record, the color has to be defined in:
Then the icon will be colored with the myBlue color. Hope it helps someone. |
Try this one. |
for react-native user, like @hannigand said , ic_launcher.png or ic_notification.png should be in this path :
|
I also had this grey square for a vector notification icon - not .png, but .xml - but the type might not be important for what i found: The reason in my case was, that i needed to change the NotificationImportance to play no sound when notifying and therefore i needed to use a new notification channel. After some trial and error i found out, that actually the name of the icon was the problem - i seems to be occupied forever for the old channel i used earlier. |
This was the only thing that made it to work. |
Thank you a lot, the notification name make it work for me (i call it notifications- did not work at start), blass you !!! |
Even if your not using firebase messaging you still need to add a resource file so that it gets included in the apk. <application>
...
<meta-data android:name="some-random-name" android:resource="@mipmap/ic_notification" /> |
Thank you a lot! It's solved my issue. Had a grey icon for received notifications when app was active. Firebase "com.google.firebase.messaging.default_notification_icon" fixed the grey icon only for notifications that I received when app was not active |
Still getting same grey and white icon |
I had the same issue, but the solution for me was to place
under the
tag in AndroidManifest.xml |
Hi!
my notification works fine on android and ios but in some android devices (motorola) instead of my app icon appear a grey square..
How I can fix it?
Thx
The text was updated successfully, but these errors were encountered: