-
Notifications
You must be signed in to change notification settings - Fork 1.8k
05. Update
Scheduled local notifications can be updated before they get presented to the user. Its also possible to update them if yet triggered and added to the notification center.
Update local notifications is similar to cancel and re-schedule them. With the difference that there will be no cancel event for the old local notification and the plugin corrects the repeat interval if necessary.
The update()
interface takes a hash as an argument to specify the local notification's properties or an array of hashes. and optionally a callback function and a scope as second and third argument. The default scope does point to the plugin.
The following list gives an overview about all properties that can be changed. Only provided local notifications are changed. Each local notification requires a numerical ID, that cannot be changed!
- title
- text
- every
- at, firstAt
- sound
- data
Android provides some additional properties as listet below.
- icon
- smallIcon
- ongoing
- led
cordova.plugins.notification.local.update({
id: 1,
text: "Updated Notification",
data: { updated:true }
});
cordova.plugins.notification.local.update([{
id: 1,
title: "Updated Notification 1"
},{
id: 2,
title: "Updated Notification 2"
}]);
The update
event is fired for each local notification when calling update().
cordova.plugins.notification.local.on("update", function(notification) {
alert("updated: " + notification.id);
});