Abh*_*hek 5 android firebase ionic-framework firebase-cloud-messaging ionic3
我正在使用Ionic FCM和Laravel FCm软件包将通知发送到应用程序。
令牌已存储在数据库中,通知也已在应用程序中接收。问题是当应用程序处于后台并且轻按了通知时,特定页面无法打开。
用于处理被窃听的通知的代码来自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");
};
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
977 次 |
| 最近记录: |