In my ionic 3 app i am using cordova-plugin-fcm-with-dependecy-updated everything working fine except 1 case.
If the app is killed and when clicking on notification then onNotification() no getting called but it's getting called if the app is open.
I have check few posts but none of them worked for me :
- https://developer.aliyun.com/mirror/npm/package/cordova-plugin-fcm-with-dependecy-updated/v/7.0.0-beta.1
- fcm.onNotification() not getting called on clicking the notification when the app is in background
Previously, I was using cordova-plugin-fcm-with-dependency-updated-apns which was working perfectly but due to UIWebView Deprecation in IOS, I need to use another option.
Here is my server payload :
{
"to" : "FCM_Token",
"notification":{
"title":"Notification title",
"body":"Notification body",
"sound":"default",
"click_action":"FCM_PLUGIN_ACTIVITY"
},
"data":{
"param1":"w1",
"param2":"w1"
},
"priority":"high"
}
I am using cordova: 10.0.0 / ionic: 3.9.2 / cordova-ios: 6.1.1 / cordova-android: 9.0.0
Anyone has an idea of how I can get onNotification() called when clicking on it if the app is killed.?
I've been using this Firebase Messaging plugin for a while now and it works great.
It's actually the featured plugin in the Ionic documentation .
It offers a different method for notifications received in the background.
You should definitely try it out.