cordova-plugin-local-notifications
cordova-plugin-local-notifications copied to clipboard
Repeat every minute after the notification set to the specified week days runs
Provide a general summary of the issue.
Your Environment
- Plugin version: 0.9.3
- Platform: Andorid
- OS version: Linux
- Cordova version (
cordova -v): 9.0.0 - Cordova platform version (
cordova platform ls): 8.0.0 - Plugin config
Expected Behavior
Notifications set to days of the week are working correctly
trigger: {every: {weekday: 3, hour: hour, minute: minutes}}
Actual Behavior
I would like to receive notifications every minute, both on certain days of the week and after the first working moment
Context
I'm creating a recurring new notification for every 1 minute at the time the notification for the day of the week is triggered, but it doesn't work when the application is completely closed.
window.cordova.plugins.notification.local.on('trigger', (notification, args) => {
app.notificationEveryMinute();
});
notificationEveryMinute: function () {
cordova.plugins.notification.local.schedule({
channel:"test2",
id: app.idDGenerator(),
title: 'Test',
text: 'TestText',
group:'test2',
sound: 'file://torpedo.mp3',
trigger: {
every: 'minute'
}
});
}
In fact, the use will work with the second.
trigger: {every: {weekday: 3, hour: hour, minute: minutes, second: second}}
Ok. I its done. Make some changes in plugin files. TriggerReceiver.java, MatchTrigger.java and Request.java
I can give advices and files if anyone needs.
@erdemakca1 I'm having an issue with this too, doing this with Ionic 3:
let date = new Date(2019, 7, 11, 12, 30); // some date in the future.
this.localNotifications.schedule({
id: 1,
title: 'title',
text: 'text',
trigger: {
every: {
weekday: date.getDay(),
hour: date.getHours(),
minute: date.getMinutes()
}
},
priority: 2,
});
But I notice in the iOS logs when I do this that it says [local-notification] Next trigger at: (null) and the notification does not trigger at the time scheduled.
Can you share your fix for this?
@erdemakca1 actually never mind I found the issue, it appears that the plugin has Sunday as weekday 7, while for a JS Date object Sunday is weekday 0. This doesn't appear to be documented so I had to find it out with trial and error...
@Steffaan were you aware of this caveat?
Yes @SimonBrazell Sunday is 7.