首页 > 解决方案 > 通知永远不会在模拟器中显示

问题描述

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

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”属性有关。我尝试了日期的不同变体,使用了“触发器”属性。似乎没有任何效果。

我错过了什么?

标签: androidcordovaionic-framework

解决方案


固定的:

Monthnumbers 从零开始,所以我指的是三月。

一月 = 0

二月 = 1

三月 = 2

等等。


推荐阅读