我正在使用Ionic FCM和Laravel FCm package向应用发送通知。
令牌存储在数据库中,通知也在应用程序中收到。问题是,当应用程序处于后台并且点击通知时,特定页面无法打开。
处理通知的处理代码取自Ionic docs:
console.log('This will print in all cases');
this.fcm.onNotification().subscribe(data => {
console.log('this will will print when app in background', data);
if (data.wasTapped) {
console.log('This never gets printed', data);
console.log("Received in background");
this.nav.setRoot(CommunicationPage, { 'message_id': data.page_id });
} else {
console.log('Data: this will will print when app in background', data);
this.nav.push(CommunicationPage, { 'message_id': data.page_id });
console.log("Received in foreground");
};
});