每天指定时间Ionic3 LocalNotification

时间:2018-07-27 09:16:27

标签: triggers ionic3 localnotification

我只看过docs,但是我尝试过的代码只能工作一次。

//this is my code
cordova.plugins.notification.local.schedule({
  id: 1,
  title: 'Attention',
  text: 'Exmaple',
  data: { mydata: 'My hidden message this is' },
  actions: [
    { id: 'yes', title: 'Yes' },
    { id: 'no', title: 'No' }
  ],

  trigger: { every: { hour: 11, minute: 0 } }//work only once
});

我也尝试过此操作(仅工作一次)

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    trigger: { in: 1, unit: 'hour' }
});

我想每天在特定时间发送通知

有关此问题:

感谢所有人

1 个答案:

答案 0 :(得分:1)

此解决方案对我有效,使用版本{strong> 0.9.0-beta.3 ,如link上所述,希望对您有所帮助。

let dailyNotification = {
  id: 1,
  title: 'Time to report',
  text: 'Send your report',
  trigger: { every: { hour: 20, minute: 0} }
};

this.localNotifications.schedule(dailyNotification);
相关问题