我正在尝试安排7个不同的通知,每天与以下代码。
const interval = 1440;
for (let i = 0; i < 7; i++) {
const notification = new firebase.notifications.Notification()
.setNotificationId(notifyId + i.toString())
.setTitle('Quote of the Day')
.setBody('today is a beautiful day')
.setData({
dailyQuote:'today is a beautiful day'
});
const date = new Date();
date.setMinutes(date.getMinutes() + (i * interval));
const schedule = {
fireDate: date.getTime(),
repeatInterval: 'day',
};
firebase.notifications().scheduleNotification(notification, schedule);
}然而,即使fireDate恰好设置在1440分钟(1天)之后,通知也会同时触发。
有人能帮上忙吗?谢谢!
发布于 2019-07-27 22:41:30
将repeatInterval更改为'week‘对我来说很管用。
const schedule = {
fireDate: date.getTime(),
repeatInterval: 'week',
};https://stackoverflow.com/questions/50746405
复制相似问题