我有以下代码来添加通知:
$cordovaLocalNotification.add({
id:"my-notification",
repeat:"daily",
date:time,
message:"a message"
});
但出于某种原因,当我运行代码取消它时:
cordova.plugin.notification.local.cancel("my-notification");
通知未清除。我所做的一切似乎都没有通知。
答案 0 :(得分:0)
本地通知插件要求ID为整数。
如果不是,插件将默默使用0作为通知的ID。
我不确定最近是否有变化,因为我觉得我过去曾使用过字符串ID。
如果有人知道将字符串映射到整数id的插件,我会发现它很有用!
答案 1 :(得分:0)
为什么不使用简单的javascript对象?
base_substring_size = string_size / no_of_threads
remainder_substring_size = string_size % no_of_threads
for thread_id = 0 to no_of_threads:
this_thread_size = base_substring_size
if remainder_substring_size > 0
this_thread_size += 1
然后使用:
获取idvar notificationMap = {"my-notitifcation-1":1, "my-not-2":2, "my-not-x":3}