【发布时间】:2018-05-02 06:35:10
【问题描述】:
我正在尝试为我的 ionic 项目创建预定通知。我希望通知在活动日期前 2 天发生。当我在设备上测试通知时,通知总是在代码执行后立即触发,而不是在稍后的计划日期触发。
我有以下代码来处理预定通知:
// event date
let eventDate = new Date('2018-06-29T10:04:11.174Z');
// 2 days before event date
let notificationDate = new Date(eventDate.getTime() - 2 * 24 * 60 * 60 * 1000);
// schedule notification
this.localNotifications.schedule({
text: 'my notification text',
trigger: {at: notificationDate},
led: 'FF0000',
sound: null
});
【问题讨论】:
-
我也有同样的问题....你解决了吗?
-
嗨,Grzegorz G,是的,我做到了。请在下面查看我的答案。
标签: cordova ionic-framework notifications