Hi all,
I decided to try implement push notification width FCM plugin. I have whole implementation in platform.ready()
function. The notification is received but onNotification
function is not fired (console.log
is not printed). What can be wrong with my implementation? It is from docs.
this.fcm.subscribeToTopic('all');
this.fcm.getToken().then(token => {
console.log("FCM TOKEN: ", token);
localStorage.setItem("registrationId", token);
})
this.fcm.onNotification().subscribe(data => {
console.log("NOTIFICATION DATA: ", data) //this line is not printed after receive push
if (data.wasTapped) {
console.log("Received in background");
} else {
console.log("Received in foreground");
}
;
})
Thanks
EDIT: On iOS it works. But on Android the problem persists.