【问题标题】:Scheduling multiple delayed local notifications in ionic 2在 ionic 2 中安排多个延迟的本地通知
【发布时间】:2017-07-28 13:44:47
【问题描述】:

我总是收到第二个对象的通知。未收到第一个对象的通知。我正在使用本地通知插件:来自 ionic native 的 https://ionicframework.com/docs/v2/native/local-notifications/。 任何帮助都会很棒。

 LocalNotifications.schedule([{
  id: 1,
  text: 'Multi ILocalNotification 1',
   at: new Date("2017-03-08T10:35:00")

}, {
  id: 2,
  title: 'Local ILocalNotification Example',
  text: 'Multi ILocalNotification 2',     
  at: new Date("2017-03-08T10:40:00")
}]);

【问题讨论】:

  • new Date("2017-03-08T10:35:00") 给出了 2017 年 3 月 8 日星期三 16:20:00 GMT+0545(尼泊尔标准时间)。那么我没有得到正确的时间。我删除了“T”并且工作正常。

标签: angular ionic2 cordova-plugins localnotification


【解决方案1】:

你好,你很幸运 我正在使用 ionic 2 我只有 1 个本地通知,但是当手机被锁定并且屏幕为黑色时它不起作用。

仅在手机处于唤醒状态时有效

let now = new Date();
    let time1=new Date();

    time1.setMinutes(now.getMinutes()+1) 
        this.timer=time1;
 this.localNotifications.schedule([{
            id:1,
            title: "test",
            text: "tester ?",
            at: time1,
            sound: "file://assets/sound/speed_camera.mp3",

        }]

【讨论】:

  • 欢迎来到 SO。请阅读此how-to-answer 以提供高质量的答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-04
  • 2017-06-26
  • 2017-01-27
  • 1970-01-01
  • 1970-01-01
  • 2018-06-11
  • 1970-01-01
相关资源
最近更新 更多