我需要在通知中添加动态添加,为此我正在使用此技术
var abc=1;
window.plugin.notification.local.getScheduledIds(function(scheduledIds) {
scheduledIds.sort()
for (var i = 1; scheduledIds.length > i; i++) {
abc=i;
}
});
并在我生成通知的每个循环中:
for (i=0;i<selectedDays.length;i++){
abc++;
var notificationObject = {
id:abc,
title:'Prayer Time',
message:'Dont forget to buy some flowers.',
repeat:'weekly',
date:null,
json: JSON.stringify({
category: cat,start_time:startTime,end_time:endTime }
)
};
var notificationObjectMonday = jQuery.extend(notificationObject, {
date : newactualdate
});
window.plugin.notification.local.add(notificationObjectMonday);
}
现在问题是它第一次给我这个
["1"]
这很好,在所有插件添加后,它给我这个:
["1","2","3","4","5","6","7","8"]
当我转到另一页并回来时再给我这个:
["1"]
它应该给我这个:
["1","2","3","4","5","6","7","8"]
我可以从9,10,11
添加更多内容答案 0 :(得分:0)
我认为你应该尝试任何随机数并使用循环索引