katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.75k forks source link

Plugin works inconsistently #1854

Closed Pratikshakhandagale closed 2 weeks ago

Pratikshakhandagale commented 4 years ago

Spend a lot of time to fix this issue, but did not found proper working solution.

Trying to trigger a notification every day at a specific time, but Its works for only 1/2 days. Please let me know, how to fix this issue.

code :

this.localNotifications.schedule({      
  id:  1,      
  title: 'App name',      
  text: 'Quiz Start...',      
  trigger: { every: { hour: 9, minute: 0 }, count: 1000 },     
  sound: 'default',      
  priority: 1,      
  foreground: true,      
  sticky: true
})
hpp-hash commented 4 years ago

I tried the code below, but the notification never triggers every minute. Do you have the same problem as well?

            cordova.plugins.notification.local.schedule({    
                title: 'Sleep App',      
                text: 'Don\'t forget to log your sleep',      
                trigger: { every: 'minute', count: 5 },     
            });
SiempreProgramadorNovato commented 4 years ago

I had the same problem. Solved it using the fork mentioned on the last comment of this #1862 with the explanation about the bug being solved.

cordova plugin add https://github.com/m0dch3n/cordova-plugin-local-notifications.git

and using after installation the following code

cordova.plugins.notification.local.schedule({ id: 50, title: "Delayed Notification", led: "FF0000", sound: 'default', trigger: { every: { hour: 10, minute: 0, second: 0 } }, led: 'FF0000', smallIcon: 'res://mipmap-ldpi/ic_launcher.png', sound: false, vibrate: false });

SiempreProgramadorNovato commented 4 years ago

You can also create one notification for each day of the week.. This solution works also:

` cordova.plugins.notification.local.schedule({ id: 51, title: "Delayed Notification 2", led: "FF0000", sound: 'default', trigger: { every: { weekday: 5, hour: 1, minute: 9, second: 1 }, count: 365 }, led: 'FF0000', smallIcon: 'res://mipmap-ldpi/ic_launcher.png', sound: false, vibrate: false });

cordova.plugins.notification.local.schedule({ id: 52, title: "Delayed Notification 3", led: "FF0000", sound: 'default', trigger: { every: { weekday: 6, hour: 9, minute: 5, second: 1 }, count: 365 }, led: 'FF0000', smallIcon: 'res://mipmap-ldpi/ic_launcher.png', sound: false, vibrate: false });

cordova.plugins.notification.local.schedule({ id: 53, title: "Delayed Notification 3", led: "FF0000", sound: 'default', trigger: { every: { weekday: 0 , hour: 9, minute: 5, second: 1 }, count: 365 }, led: 'FF0000', smallIcon: 'res://mipmap-ldpi/ic_launcher.png', sound: false, vibrate: false }); `