Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeat every minute after the notification set to the specified week days runs #23

Open
erdemakca1 opened this issue Jul 16, 2019 · 4 comments

Comments

@erdemakca1
Copy link

erdemakca1 commented Jul 16, 2019

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}}

@erdemakca1
Copy link
Author

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.

@SimonBrazell
Copy link

@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?

@SimonBrazell
Copy link

@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?

@erdemakca1
Copy link
Author

Yes @SimonBrazell Sunday is 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants