【问题标题】:Ionic 3 push notification with payload带有有效负载的 Ionic 3 推送通知
【发布时间】:2017-06-05 08:04:36
【问题描述】:

我已在 ionic 应用程序中集成推送并且它正在工作。我使用 push.rx.notification().subscribe() 来监听通知。它在应用程序处于前台时工作。但是当应用程序没有打开时,会收到通知, push.rx.notification().subscribe() 不会被调用。这是我的 app.component.ts 代码:

this.push.register().then((t: PushToken) => {
    return this.push.saveToken(t);
  }).then( (t: PushToken) => {
  }).catch( (err) => {
    console.log('Error Saving Token: ' , err);
  });

  this.push.rx.notification()
  .subscribe((msg: any) => {
//this block only executing when in foreground
    console.log('Push Mesg : ' + msg.title + ' ' + msg.text);
  });

我正在从 Ionic 仪表板发送推送。

【问题讨论】:

    标签: ionic-framework notifications push


    【解决方案1】:

    当您单击通知时,会调用 rx 块内的代码。 仅当使用 ionic api(通过仪表板或 http 请求)发送推送时才会发生这种情况,但如果您使用本机 api(android/ios)发送推送则不起作用。推送通知出现,但 rx.notification 方法从未被调用。

    【讨论】:

    • 我已经提到过了。我正在从 Ionic 仪表板发送推送。
    猜你喜欢
    • 1970-01-01
    • 2018-04-04
    • 2017-05-31
    • 2016-07-19
    • 1970-01-01
    • 1970-01-01
    • 2015-04-10
    • 1970-01-01
    • 2014-12-01
    相关资源
    最近更新 更多