代码之家  ›  专栏  ›  技术社区  ›  user8626881

如何每X分钟设置一次本地通知?

  •  2
  • user8626881  · 技术社区  · 7 年前

    this.localNotifications.schedule({
                  id: 0,
                  text: 'Message',
                  sound: this.platform.is('android') ? 'file://sound.mp3' : 'file://beep.caf',
                  every: this.NotificationsTimer,
                  icon: 'notification_icon',
                  led: '#ff00c3'
                });
    

    this.NotificationsTimer 值为 5 . 但它不起作用,我该怎么做?

    1 回复  |  直到 7 年前
        1
  •  0
  •   André Laszlo    7 年前

    看起来你现在使用的爱奥尼亚版本是0.8.5。那么你应该使用 every 使用以下字符串之一:

    • 第二
    • 分钟
    • 小时
    • 一刻钟

    如果您使用的是最新版本(0.9.x,目前处于测试阶段),那么还有更多选项。以下信息摘自 cordova-plugin-local-notifications

    重复,从现在开始相对:

    trigger: { every: 'day', count: 5 }
    

    或者每次日期匹配时:

    trigger: { every: { month: 10, day: 27, hour: 9, minute: 0 } }