Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Changing push notification icon - blank android icon issue in 2018 #764
For people using this plugin with cordova 8+ you might find that changing your notification icon wont work and you hit the old 'notification icon is blank square' issue on android. This happens because android notification icons have to be simple 1 color shape on transparent background and if you haven't provided such icon android will use application icon instead. Those are most likely a full and colourful squares without any transparent background.
This is very annoying when setting new Ionic 3 project and trying to use this plugin.
Readme here atm does not describe process of changing your icon correctly. Here are the steps you need to take to change the icon:
So notification payload that you send to firebase from your backend has to look somewhat like this: THIS IS THE ONLY VERSION THAT WORKS
Let me reiterate - USING ANDROID SPECIFIC PARAMS DOES NOT WORK WITH FIREBASE AS OF July 2018 - BELOW WONT WORK AND YOUR NOTIFICATION ICON WONT CHANGE REGARDLESS OF WHAT THEIR DOCUMENTATION SAYS:
I hope this long write up will help others in the future, as the amount of hurdle one has to go through to change small 10x10 icon is simply to damn high...
Please test if this code added to config.xml
This works for me sending by Firebase Cloud Messaging panel or back-end with no icon on payload.
Hi, thanks for the moral support, and giving me the feeling that I am not the only one who ended up in this mess. However, unfortunately, I gravitated back to pre-step 0, losing hair on the way.
When I try to send the notification through the http/post method, I get errors from the firebase api that the json is invalid. I've tried both ways:
This is what I get when including the icon as
This is the message I get when including the icon as
but maybe I am using this in the wrong context (our backend cloud code sending a notification to client apps using firebase cloud messaging).
In fact, when I read this, this suggest that the icon should be in
I just tried, and this actually works for me! So I suppose it depends on serverprotocol how the payload should be structured...
Thanks, everyone, for this discussion. It has finally resulted in me stopping pulling my hair out...