离子FCM通知点击不接收数据的背景

时间:2018-04-13 05:07:27

标签: android firebase ionic-framework ionic3 firebase-cloud-messaging

我正在使用Ionic FCMLaravel 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");
  };
});

0 个答案:

没有答案