问题
I want to get local notification everyday at 10:00 AM . my code is:
var pushTime = moment().add(0, 'days').hours(10).minutes(0).seconds(0);
cordova.plugins.notification.local.schedule({
id: 1,
text: 'Tracking Enabled ',
trigger: { at: pushTime.toDate() },
every: 'day'
});
回答1:
Try to use trigger as below:
trigger: {
firstAt: pushTime.toDate(),
every: ELocalNotificationTriggerUnit.DAY
}
回答2:
let notifications = []
let template = {
data: "value",
id: 1,
title: "daily alarm",
text: 'Code something epic today!',
launch: true,
foreground: true,
trigger: { every: { hour: 10, minute: 0 } },
}
notifications.push(template)
cordova.plugins.notification.local.schedule(notifications);
来源:https://stackoverflow.com/questions/50227613/how-to-get-local-notification-everyday-at-specific-time-in-ionic