Open joemak93 opened 5 years ago
onNotification not fire.
The plugin works perfectly on Android, but I found the onNotification not called in iOS. it can get the FCM token, the push message arrived the phone in both foreground and background, but when click the message, the onNotification not called. here is my code:
this.fcm.onNotification().subscribe(data => { if(data.wasTapped){ console.log("Received in background = "+ JSON.stringify(data)); } else { console.log("Received in foreground = "+ JSON.stringify(data)); }; });
I'm using cordova-plugin-fcm-with-dependecy-updated 2.2.4
Hi Did you find solution . i couldnot able to figure out even added APNS in firebase console .onNotification is not firing
same here
As I also had localNotification plugin, i don't know the reason but, onNotification() never fired. I removed it and works as i expected. Instead of using a local notification, I display an alert.
I had simular problem in a long time. I have solved my problem. IOS: I getthe token, but I dont get pushed notifications despite they reach the mobilephones notification tray. My solution - actually quite simple:
The FCMPlugin.onNotification should be declared AFTER the device is ready: addeventlistner...deviceready.
document.addEventListner("deviceready",onDeviceReady,false); function onDeviceReady(){ FCMPlugin.onNotification(function(data){..... }
Anyone get this working?
Quick update: I got this working by skipping the demo project and setting up my own node service using https://github.com/smartnav/fcm-notification.
Hi @joemak93, @jffs, @githubkyo i tried and able to navigate to other pages on clicking on notification. as i saw your code and found that the ios console does not store the previous consoles, as android console do. So you are not able to see the console. you please show any toast, or navigate to any other page can see the demo code. i just showed a toast.
this.platform.ready().then(() => {
this.fcm.onNotification().subscribe(data => {
if (data.wasTapped) {
this.apiService.showSuccess("Notification clicked");
}
});
});
As I also had localNotification plugin, i don't know the reason but, onNotification() never fired. I removed it and works as i expected. Instead of using a local notification, I display an alert.
This worked for me.
The plugin works perfectly on Android, but I found the onNotification not called in iOS. it can get the FCM token, the push message arrived the phone in both foreground and background, but when click the message, the onNotification not called. here is my code:
I'm using cordova-plugin-fcm-with-dependecy-updated 2.2.4