Ionic 2推送有效载荷 - 如何在组件中使用有效载荷

时间:2016-11-28 15:50:37

标签: android push-notification ionic2

我向Firebase发送推送通知,但它确实有效。当我通过推送通知发送有效负载时,如何从组件中的有效负载读取数据。

当我从observable警告msg对象时,它会提醒[object,Object]

const cloudSettings: CloudSettings = {
    'core': {
        'app_id': 'fec59dd8'
    },
    'push': {
        'sender_id': '808269516661',
        'pluginConfig': {
            'ios': {
                'badge': true,
                'sound': true
            },
            'android': {
                'iconColor': '#343434',
                'senderID': '808269516661'
            }
        }
    }
};

以下是订阅推送通知的代码

this.push.rx.notification()
  .subscribe((msg) => {
    alert(msg.title + ': ' + msg.text);

    if (msg.app.asleep || msg.app.closed) {
      // The app is being opened from a notification
      alert("OPEN APP");
      alert(msg);
      this.rootPage = RetailPage;
    } else {
      // The app was already open when the notification was received
      alert("APP WAS OPEN");
    }
  });
  }

您的系统信息:

ordova CLI:6.3.1 离子框架版本:2.0.0-rc.3 离子CLI版本:2.1.12 Ionic App Lib版本:2.1.7 Ionic App Scripts版本:0.0.46 ios-deploy版本:未安装 ios-sim版:未安装 操作系统:Windows 10 节点版本:v6.7.0 Xcode版本:未安装

任何帮助表示赞赏

祝你好运

0 个答案:

没有答案