Reputation: 131
The onNotification
callback doesn't fire after tapping on a notification while the app is in background.
The app goes to the foreground, but the JS event handler does not execute. Also, in the case of Android, there are no messages containing FCMPluginActivity
in Logcat, therefore I think that the corresponding activity does not start.
Since we use meteor, Cordova version is fixed by Meteor version, and the newest meteor version has cordova-android v7.1.4 and cordova-ios v4.5.5, failing the requirements to use the latest version of cordova-plugin-fcm-with-dependecy-updated
. So we use version 3.2.0.
How to reproduce (in case of Android):
meteor create --full ./test-fcm
.meteor add cordova:[email protected]
.App.info({id: "com.yourCompany.appId"});
.meteor run android
.onNotification
event handler: window.FCMPlugin.onNotification((data) => { console.log(data); });
.Any advice will help. Thanks!
Upvotes: 1
Views: 431
Reputation: 131
Turns out we forgot to add click_action
field to the FCM request payload ("click_action":"FCM_PLUGIN_ACTIVITY"
).
With this field in place onNotification
works correctly.
Upvotes: 2