通知永远不会显示在模拟器中

时间:2019-01-31 14:37:15

标签: android cordova ionic-framework

我正在尝试在特定日期和时间显示通知。我已经尝试了很多,但从未在模拟器中显示过。我找到并编辑了这段代码:

createnotification() {
    let remindid = new Date().getUTCMilliseconds();
    this.date = moment(“2019-01-31 12:20:00”).format(“YYYY-MM-DD HH:mm:ss”);

    let notification = {
        id: remindid,
        title: this.title,
        text: this.description, 
        forceShow: 'true',
        coldstart: true,
        foreground: false,
        at: this.date
    };

    cordova.plugins.notification.local.schedule(notification);

    let alert = this.alrtCtrl.create({
      title: 'Notifications set at ' + this.date,
      buttons: ['Ok']
    });

    alert.present();
}

我认为这与“ at”属性有关。我使用“触发”属性尝试了不同的日期变化。似乎没有任何作用。

我想念什么?

1 个答案:

答案 0 :(得分:0)

已修复:

月份数字从零开始,所以我指的是三月。

一月= 0

2月= 1

3月= 2

等等。