Reputation: 692
I want to give local notification at 7:00 am every day using cordova local notification plugin but in the documentation it is not specified how to set time for a repeating notification
$cordovaLocalNotification.schedule({
id: 3,
title: 'Warning',
text: 'Dont fall asleep',
every: 'minute'
}).then(function (result) {
console.log('Notification 3 triggered');
});
Upvotes: 1
Views: 1711
Reputation: 159
If you are using cordova-plugin-local-notifications, I think It should be:
var date = new Date()
date.setDate(date.getDate()+1);
date.setHours(7);
date.setMinutes(0);
date.setSeconds(0);
$cordovaLocalNotification.schedule({
id: 3,
title: 'Warning',
text: 'Dont fall asleep',
at: date,
every: 'day'
}).then(function (result) {
console.log('Notification 3 triggered');
});
This should schedule a notification the next day at 7, that will be repeated every day, but I couldn't try it, I'm sorry.
Upvotes: 2
Reputation: 4024
The property for setting the time is firstAt. You can find out the documentation about the plugin here.
Upvotes: 0