Local Notification every day at same time

I integrated local notification plugin into my app and I want to schedule a notify every day at same hour:minute.

"@ionic-native/local-notifications": "^4.20.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",

Official Documentation seems different to my version but I don’t understand the reason.

In my VSCode tool I receive compilation error when I use property “every”

It doesn’t work

this.localNotifications.schedule({
        title: 'Design team meeting',
        trigger: { every: 'day', hour: 10, minute: 30 }
});

It works

var time = new Date().getTime() + 5 * 1000;
      
// Schedule delayed notification
this.localNotifications.schedule({
        id: 1,
        title: 'My notify' + new Date().toISOString(),
        text: 'La mia notifica locale',
        trigger: {at: new Date(time)}
});

Help me please

L

I tried this scheduling:

this.localNotifications.schedule({ 
          id: i,
          text: "Notifica 15 ",
          title: 'Hello!!! ', 
          trigger: { 
            every: {
              hour: 15,
              minute: 40 
            } 
          } 
        });

the notify appears but there is a infinite loop of notification

:frowning:

could you please help me?

It will keep sending notifications for one minute till the time you putted passes, so you need to make a count.
inside the trigger add count:

this.localNotifications.schedule({ 
          id: i,
          text: "Notifica 15 ",
          title: 'Hello!!! ', 
          trigger: { 
            every: {
              hour: 15,
              minute: 40 
            } ,
            count: 1,
          } 
        });

Thanks @Hech96, but I need to schedule local push every day at specific time forever. I will disable it only if user disable manually push notification service.

I’d like to schedule trigger for every day but I don’t understand How.

Thanks for your support

L

Hello, to schedule trigger for every day, you can use the code below. For example schedule notification every day at 9:45 AM

let firstNotificationTime = new Date();
firstNotificationTime.setHours(firstNotificationTime.getHours() + (24));
firstNotificationTime.setHours(9);
firstNotificationTime.setMinutes(45); 

this.localNotifications.schedule({
        title: 'Design team meeting',
        trigger: { at: firstNotificationTime }
});