IonicとFirebaseを使用したプッシュ通知のjavebrattのfitCoachの例をテストしています。 javebratt/fitCoachnotificacionをクリックした後にIonicのページにリダイレクト
プッシュはうまく到着しますが、ページのリダイレクトが発生すると、電話で次のエラーが表示されます。
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();
});
I githubから彼のレポをクローンしました、何か提案?
おかげで
から欠落していた答えは、変更トークンの用心ました。 Firebaseと比較するためにトークンをコンソールに記録し、fcm.onTokenRefreshを使用します。 – nrodriguezm