在离子2中安排多个延迟的本地通知

时间:2017-03-08 05:36:44

标签: angular ionic2 cordova-plugins localnotification

我总是收到第二个对象的通知。未收到第一个对象的通知。我正在使用本地通知插件:来自离子原生的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")
}]);

1 个答案:

答案 0 :(得分:0)

你好,你很幸运 我正在使用离子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",

        }]