I have the following code to add a notification:
$cordovaLocalNotification.add({
id:"my-notification",
repeat:"daily",
date:time,
message:"a message"
});
But for some reason, when I run the code to cancel it:
cordova.plugin.notification.local.cancel("my-notification");
The notification isn't cleared. Nothing I do seems to clear the notification.
The local notification plugin requires that the IDs are Integers.
If they aren't, the plugin will silently use 0 as the id for the notification.
I'm not sure if this has changed recently because I feel like I've used string ids in the past.
If anyone knows of a plugin for mapping strings to integer ids, I would find that useful!
Why don't you use a simple javascript object?
var notificationMap = {"my-notitifcation-1":1, "my-not-2":2, "my-not-x":3}
then get the id using:
notificationMap["my-notitifcation-1]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.