jos*_*ero 6 notifications localnotification phonegap-plugins cordova
我正在开发一个带有cordova的应用程序,我正在使用这个插件来安排每天到6点的本地通知 https://github.com/katzer/cordova-plugin-local-notifications
一切正常,这是我用来设置de Notification的代码
Run Code Online (Sandbox Code Playgroud)/*Set 6 o'clock*/ function setTestAlarm() { var notify = new Date(); notify.setHours(18,00,00,00); localNotification.add({ id: 1, title: 'My app', message: 'Hi this is a notification', repeat: 'daily', date: notify, autoCancel: true, ongoing: true, });
我正在进行测试,并且通知每天下午6点出现,但仅连续9天,然后停止出现.我究竟做错了什么?
谢谢
虽然已经很晚了,但请尝试以下网址:https://github.com/katzer/cordova-plugin-local-notifications/wiki/11.-Samples
cordova.plugins.notification.local.schedule({
id: 1,
text: "Good morning!",
firstAt: tomorrow_at_6_am,
every: "day" // "minute", "hour", "week", "month", "year"
});
Run Code Online (Sandbox Code Playgroud)
对于tomorrow_at_6_am您可以尝试以下方法:
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate()+1);
tomorrow.setHours(6);
tomorrow.setMinutes(0);
tomorrow.setSeconds(0);
var tomorrow_at_6_am = new Date(tomorrow);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5031 次 |
| 最近记录: |