Schedule local notification every day with a cordova calling card

I am developing an application with a corridor, and I use this plugin to schedule local notifications every day up to 6 hours https://github.com/katzer/cordova-plugin-local-notifications

Everything works fine, this is the code I use to install Notification

/*Set 6 o'clock*/ function setTestAlarm() { var notify = new Date(); notify.setHours(18,00,00,00); localNotification.add({ id: 1, title: 'My app', message: 'Hi this is a notification', repeat: 'daily', date: notify, autoCancel: true, ongoing: true, }); 

I tested, and the notification appears every day at 6 pm, but only for 9 consecutive days, and then stops appearing. What am I doing wrong?

thanks

+6
source share
1 answer

Although late, try the following: https://github.com/katzer/cordova-plugin-local-notifications/wiki/11.-Samples

 cordova.plugins.notification.local.schedule({ id: 1, text: "Good morning!", firstAt: tomorrow_at_6_am, every: "day" // "minute", "hour", "week", "month", "year" }); 

For tomorrow_at_6_am you can try the following:

 var today = new Date(); var tomorrow = new Date(); tomorrow.setDate(today.getDate()+1); tomorrow.setHours(6); tomorrow.setMinutes(0); tomorrow.setSeconds(0); var tomorrow_at_6_am = new Date(tomorrow); 
+7
source

Source: https://habr.com/ru/post/982350/


All Articles