|
|
%!s(int64=12) %!d(string=hai) anos | |
|---|---|---|
| src | %!s(int64=12) %!d(string=hai) anos | |
| www | %!s(int64=12) %!d(string=hai) anos | |
| LICENSE | %!s(int64=12) %!d(string=hai) anos | |
| README.md | %!s(int64=12) %!d(string=hai) anos | |
| plugin.xml | %!s(int64=12) %!d(string=hai) anos |
A bunch of local notification plugins for Cordova 3.x.x
by Sebastián Katzer (github.com/katzer)
iOS
See Local and Push Notification Programming Guide for detailed informations and screenshots.
Android
See Notification Guide for detailed informations and screenshots.
WP8
See Local notifications for Windows Phone for detailed informations and screenshots.
Through the Command-line Interface:
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
Through the Command-line Interface:
cordova plugin rm de.appplant.cordova.plugin.local-notifications
add() function now returns the id of the created notification.title property.The plugin creates the object window.plugin.notification.local with the following methods:
The method allows to add a custom notification. It takes an hash as an argument to specify the notification's properties and returns the ID for the notification.
All properties are optional. If no date object is given, the notification will pop-up immediately.
window.plugin.notification.local.add({
id: id, // a unique id of the notifiction
date: date, // this expects a date object
message: message, // the message that is displayed
title: title, // the title of the message
repeat: repeat, // has the options of daily', 'weekly',''monthly','yearly')
badge: badge, // displays number badge to notification
foreground: forground, // a javascript function to be called if the app is running
background: background, // a javascript function to be called if the app is in the background
sound: sound // (only iOS) a sound to be played, the sound must be located in your project's resources and must be a caf file
});
The method cancels a notification which was previously added. It takes the ID of the notification as an argument.
window.plugin.notification.local.cancel(__id__);
The method cancels all notifications which were previously added by the application.
window.plugin.notification.local.cancelAll();
var now = new Date().getTime(),
_60_seconds_from_now = new Date(now + 60*1000);
window.plugin.notification.local.add({
id: 1,
date: _60_seconds_from_now,
message: 'Hello world!',
title: 'Check that out!',
repeat: 'weekly', // will fire every week on this day
foreground: 'foreground',
background: 'background'
});
function foreground (id) {
console.log('I WAS RUNNING ID='+id)
}
function background (id) {
console.log('I WAS IN THE BACKGROUND ID='+id)
}
Windows Phone 8.0 has no notification center. Instead local notifications are realized through live tiles updates.