I am using ionic3 to build a hybrid app and use this fcm push notification cordova plugin for receiving notification
I have been able to achieve the notifications landing on the device and app being triggered (with data like title, body, custom, etc.)
But whenever the notification is delivered the notification icon is displayed as android bot. like
My Launcher icon is a different icon, which works fine
To initiate the notification, I send a curl request to https://fcm.googleapis.com/fcm/send with the following json:
{
"to":"device_token",
"priority":"high",
"notification":{
"title":"New Notification!",
"body":"Test",
"sound":"default",
"click_action":"FCM_PLUGIN_ACTIVITY",
"icon": "icon" //optional piece
},
}
A icon.png is present in all android/res/mipmap*
directories.
Also, I have added the following meta in my AndroidManifest.xml reference
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/icon" />
Also, I have tried to read logcat from the device. Whenever I have passed icon param in the json that I post to fcm, I see the following log
06-12 23:43:38.457 22257 22303 W FirebaseMessaging: Icon resource icon not found. Notification will use default icon.
But whenever I don't pass the icon in the json, I dont see the above message in logcat.
I think I am missing a simple thing somewhere but not able to figure it out Please help me with some pointers, guidance on where i may be wrong
Thanks in advance
Finally I was able to figure the issue. I had to dwell further into ADB logs to find the following:
06-18 20:46:59.898 11432 11470 E FirebaseMessaging: Icon with id: 2131165319 uses an invalid gradient. Using fallback icon.
Then I got a reference to this
On further investigation I found that my project.properties and FCMPlugin.gradle were pointing to firebase 11.8.0
Changing that to 11.0.1 at both the places and rebuilding the app, I was able to receive the notification with icon