-
Notifications
You must be signed in to change notification settings - Fork 3
Upgrade Guide
Version 0.8 is a complete rewrite of the plugin compared to version 0.7. Beside some deprecations and incompatibilities it contains a lot of bug fixes, enhancements, new interfaces and features. Also a bunch of exciting features and even more platforms are in planing and will make the plugin even more useful for you in the near future.
- Support for iOS 8, Android 2 (SDK >= 7) and Android 5
- Windows Phone 8.1 will be added soon
- New interfaces to ask for / register permissions required to schedule local notifications
-
hasPermission()
andregisterPermission()
- schedule() will register the permission automatically and schedule the notification if granted.
- New interface to update already scheduled|triggered local notifications
update()
- New interfaces to clear the notification center
-
clear()
andclearAll()
- New interfaces to query for local notifications, their properties, their IDs and their existence depend on their state
-
isPresent()
,isScheduled()
,isTriggered()
-
getIds()
,getAllIds()
,getScheduledIds()
,getTriggeredIds()
-
get()
,getAll()
,getScheduled()
,getTriggered()
- Schedule multiple local notifications at once
schedule( [{...},{...}] )
- Update multiple local notifications at once
update( [{...},{...}] )
- Clear multiple local notifications at once
clear( [1, 2] )
- Cancel multiple local notifications at once
cancel( [1, 2] )
- New URI format to specify sound and image resources
-
http(s):
for remote resources (Android) -
file:
for local resources relative to the www folder -
res:
for native resources - New events
-
schedule
,update
,clear
,clearall
andcancelall
- Enhanced event informations
- Listener will get called with the local notification object instead of only the ID
- Multiple listener for one event
on(event, callback, scope)
- Unregister event listener
un(event, callback)
- New Android specific properties
-
led
properties -
sound
andimage
accepts remote resources - Callback function and scope for all interface methods
schedule( notification, callback, scope )
- Kitchen Sink sample app
- Wiki
There is a new namespace for the plugin. The old one will be removed with v0.9.
cordova.plugins.notification.local
All following - except the events - can still be used but their support will be removed with v0.9.
Old | Type | New |
---|---|---|
add() | Interface | Renamed to schedule() . The event name has been renamed too. |
onadd | Event | Please use notification.local.on("schedule", callback, scope)
|
ontrigger | Event | Please use notification.local.on("trigger", callback, scope)
|
onclick | Event | Please use notification.local.on("click", callback, scope)
|
oncancel | Event | Please use notification.local.on("cancel", callback, scope)
|
date | Property | Renamed to at or firstAt
|
json | Property | Renamed to data
|
message | Property | Renamed to text
|
repeat | Property | Renamed to every Repeat intervals have also been renamed to second , minute , hour , day , week , month and year
|
autoCancel | Property | Has been removed. Non repeating local notification do auto cancel and repeating local notifications not. |
You can schedule local notifications with the deprecated properties. But if you query for the local notification, the new property name will be used.
cordova.plugins.notification.local.schedule({ message:"Hello World" });
cordova.plugins.notification.local.get(0, function (notification) {
alert(notification.text); //=> "Hello World"
alert(notification.message); //=> undefined
});
Beside the way how to listen for events the callback signature has been enhanced as well.
cordova.plugins.notification.local.on("click", function (notification, state) {
...
})