Commit 51db8203 by Sebastián Katzer

Updated Readme

parent 9f064596
...@@ -12,6 +12,10 @@ See [Local and Push Notification Programming Guide](http://developer.apple.com/l ...@@ -12,6 +12,10 @@ See [Local and Push Notification Programming Guide](http://developer.apple.com/l
- **Android**<br> - **Android**<br>
See [Notification Guide](http://developer.android.com/guide/topics/ui/notifiers/notifications.html) for detailed informations and screenshots. See [Notification Guide](http://developer.android.com/guide/topics/ui/notifiers/notifications.html) for detailed informations and screenshots.
- **WP8**<br>
See [Tiles, Lock and Notifications for Windows Phone 8](http://code.msdn.microsoft.com/Tiles-Lock-and-Notification-e63f498b) for detailed informations and screenshots.
## Adding the Plugin to your project ## Adding the Plugin to your project
Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface): Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface):
``` ```
...@@ -25,6 +29,12 @@ cordova plugin rm de.appplant.cordova.plugin.local-notifications ...@@ -25,6 +29,12 @@ cordova plugin rm de.appplant.cordova.plugin.local-notifications
``` ```
## Release Notes ## Release Notes
#### Version 0.6.0 (not yet released)
- Added WP8 support<br>
*Based on the LiveTiles WP8 plugin made by* ***XXX***
- [enhancement:] The `add()` function now returns the id of the created notification.
- [feature:] Added new `title` property.
#### Version 0.4.0 (06.10.2013) #### Version 0.4.0 (06.10.2013)
- Added Android support<br> - Added Android support<br>
*Based on the LocalNotifications Android plugin made by* ***Daniël (dvtoever)*** *Based on the LocalNotifications Android plugin made by* ***Daniël (dvtoever)***
...@@ -33,15 +43,20 @@ cordova plugin rm de.appplant.cordova.plugin.local-notifications ...@@ -33,15 +43,20 @@ cordova plugin rm de.appplant.cordova.plugin.local-notifications
- Added iOS support<br> - Added iOS support<br>
*Based on the LocalNotifications iOS plugin made by* ***Rodrigo Moyle*** *Based on the LocalNotifications iOS plugin made by* ***Rodrigo Moyle***
## Using the plugin ## Using the plugin
The plugin creates the object ```window.plugin.notification.local``` with the following methods: The plugin creates the object ```window.plugin.notification.local``` with the following methods:
### add() ### add()
The method allows to add a custom notification. It takes an hash as an argument to specify the notification's properties. All properties are optional. If no date object is given, the notification will popup immediately. 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.<br>
All properties are optional. If no date object is given, the notification will popup immediately.
```javascript ```javascript
window.plugin.notification.local.add({ window.plugin.notification.local.add({
id: id, // a unique id of the notifiction
date: date, // this expects a date object date: date, // this expects a date object
message: message, // the message that is displayed message: message, // the message that is displayed
title: title, // the title of the message
repeat: repeat, // has the options of daily', 'weekly',''monthly','yearly') repeat: repeat, // has the options of daily', 'weekly',''monthly','yearly')
badge: badge, // displays number badge to notification badge: badge, // displays number badge to notification
foreground: forground, // a javascript function to be called if the app is running foreground: forground, // a javascript function to be called if the app is running
...@@ -67,9 +82,11 @@ window.plugin.notification.local.cancelAll(); ...@@ -67,9 +82,11 @@ window.plugin.notification.local.cancelAll();
var now = new Date().getTime(), var now = new Date().getTime(),
_60_seconds_from_now = new Date(now + 60*1000); _60_seconds_from_now = new Date(now + 60*1000);
window.plugin.notification.local.add({ var notificationId = window.plugin.notification.local.add({
id: 1,
date: _60_seconds_from_now, date: _60_seconds_from_now,
message: 'Hello world!', message: 'Hello world!',
title: 'Check that out!',
repeat: 'weekly', // will fire every week on this day repeat: 'weekly', // will fire every week on this day
foreground: 'foreground', foreground: 'foreground',
background: 'background' background: 'background'
...@@ -82,9 +99,4 @@ function foreground (id) { ...@@ -82,9 +99,4 @@ function foreground (id) {
function background (id) { function background (id) {
console.log('I WAS IN THE BACKGROUND ID='+id) console.log('I WAS IN THE BACKGROUND ID='+id)
} }
``` ```
\ No newline at end of file
**Android:** The `message` property can be devided into *title* and *subtitle* section:
```javascript
message: "Title\r\nSubtitle comes after linebreak"
```
...@@ -16,6 +16,7 @@ LocalNotification.prototype = { ...@@ -16,6 +16,7 @@ LocalNotification.prototype = {
* Fügt einen neuen Eintrag zur Registry hinzu. * Fügt einen neuen Eintrag zur Registry hinzu.
* *
* @param {Object} options * @param {Object} options
* @return {Number} Die ID der Notification
*/ */
add: function (options) { add: function (options) {
var defaults = { var defaults = {
...@@ -40,6 +41,8 @@ LocalNotification.prototype = { ...@@ -40,6 +41,8 @@ LocalNotification.prototype = {
} }
cordova.exec(null, null, 'LocalNotification','add', [defaults]); cordova.exec(null, null, 'LocalNotification','add', [defaults]);
return defaults.id;
}, },
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment