0
我正在測試javebratt的fitCoach示例,用於使用Ionic和Firebase進行推送通知。 javebratt/fitCoach點擊通知後重定向到離子頁面
推送到達不錯,但是當發生頁面重定向時,我在手機上看到以下錯誤。
Error seen on device when clicking on notification, page redirection should happen here
Line in app.component.ts where navCtrl error is trigered
代碼從app.component.ts如下:
platform.ready(),然後(()=> {
fcm.onNotification().subscribe(data => {
if(data.wasTapped){
authUnsubscribe.unsubscribe();
//Notification was received on device tray and tapped by the user.
console.log(JSON.stringify(data));
this.navCtrl.setRoot('ClientDetailPage', { 'clientId': data.clientId});
}else{
//Notification was received in foreground. Maybe the user needs to be notified.
console.log(JSON.stringify(data));
this.navCtrl.push('ClientDetailPage', { 'clientId': data.clientId});
}
});
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
});
我從github克隆他的回購,有什麼建議?
感謝
正如阿里納斯,謹防設備測試應用程序時改變令牌。將令牌記錄到控制檯以與Firebase進行比較並使用fcm.onTokenRefresh。 – nrodriguezm