Reputation: 538
I am trying to send a local notification every hour with Ionic Framework... It asked for permissions to sent a notification but I never got one on my iOS device.
var oneHourLater = new Date();
oneHourLater.setHours(oneHourLater.getHours() + 1)
var notification = {
id: 1,
title: 'Reminder',
text: 'Reminding you about a thing',
every: 'hour',
at: oneHourLater
};
localNotifications.schedule(notification);
If this is not too much to ask is there any way to also not send one after a certain time so it does not get too annoying and then start them up again at a certain time?
Thanks!
Upvotes: 1
Views: 774
Reputation: 8271
For setting the Local Notification at every One hour can be achieved using this plugin as follows:
localNotifications.schedule({
id: 1,
title:'Reminder',
text: "Reminder you about a thing",
firstAt: After_1_hour,
every: "hour" // "minute", "hour", "week", "month", "year"
});
For After_1_hour
you can try the following:
var today = new Date();
today.setHours(1);
today.setMinutes(0);
today.setSeconds(0);
var After_1_hour = new Date(today);
Upvotes: 1