我必须在我的离子3移动应用程序中安排两次本地通知。这些通知需要间隔1小时。例如:如果第一个通知是在下午3时发出的,那么第二个本地通知应该在下午4:00发出。
有人能建议一种方法来获得第一次通知触发的时间吗?这样我就可以增加1小时的时间并安排第二次通知。
提前谢谢。斯克尔
发布于 2017-11-09 21:51:32
您可以在这里使用本地通知插件:
https://ionicframework.com/docs/native/local-notifications/
使用这样的调度方法:
this.localNotifications.schedule({
id: 1,
text: 'Single Immediate ILocalNotification',
sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
data: { secret:'hi' }
});
let originalTime = new Date().getTime();
// Schedule delayed notification (1 hour from original time)
this.localNotifications.schedule({
id: 2,
text: 'Delayed 1 hour ILocalNotification',
at: new Date(originalTime + 3600000), // 3600000 is 1 hour in milliseconds
sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
data: { secret:'hi 1 hour later' }
});https://stackoverflow.com/questions/47210252
复制相似问题