|
@@ -5,11 +5,11 @@ A bunch of local notification plugins for Cordova 3.x.x
|
|
|
|
|
|
|
|
by Sebastián Katzer ([github.com/katzer](https://github.com/katzer))
|
|
by Sebastián Katzer ([github.com/katzer](https://github.com/katzer))
|
|
|
|
|
|
|
|
-## Supported Platforms ##
|
|
|
|
|
|
|
+## Supported Platforms
|
|
|
- **iOS**<br>
|
|
- **iOS**<br>
|
|
|
See [Local and Push Notification Programming Guide](http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html) for detailed informations and screenshots.
|
|
See [Local and Push Notification Programming Guide](http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html) 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):
|
|
|
```
|
|
```
|
|
|
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
|
|
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
|
|
@@ -21,55 +21,53 @@ Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/gui
|
|
|
cordova plugin rm de.appplant.cordova.plugin.local-notifications
|
|
cordova plugin rm de.appplant.cordova.plugin.local-notifications
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Release Notes ##
|
|
|
|
|
-#### Version 0.2.0 (11.08.2013) ####
|
|
|
|
|
|
|
+## Release Notes
|
|
|
|
|
+#### Version 0.2.0 (11.08.2013)
|
|
|
- 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 three methods:
|
|
The plugin creates the object ```window.plugin.notification.local``` with three methods:
|
|
|
|
|
|
|
|
-### add() ###
|
|
|
|
|
|
|
+### add()
|
|
|
All settings are optional. If no date object is given, the notification will popup immediately.
|
|
All settings are optional. If no date object is given, the notification will popup immediately.
|
|
|
|
|
|
|
|
To add a custom notification:
|
|
To add a custom notification:
|
|
|
```javascript
|
|
```javascript
|
|
|
window.plugin.notification.local.add({
|
|
window.plugin.notification.local.add({
|
|
|
- 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
|
|
|
repeat: repeat, // has the options of 'weekly','daily','monthly','yearly')
|
|
repeat: repeat, // has the options of 'weekly','daily','monthly','yearly')
|
|
|
- badge: badge, // displays number badge to notification
|
|
|
|
|
- foreground: forground, // a javascript function to be called if the app is running
|
|
|
|
|
|
|
+ badge: badge, // (only iOS) 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
|
|
background: background, // a javascript function to be called if the app is in the background
|
|
|
- sound: sound // a sound to be played, the sound must be located in your project's resources and must be a caf file
|
|
|
|
|
|
|
+ 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
|
|
|
});
|
|
});
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### clear() ###
|
|
|
|
|
-To clear a specific notification:
|
|
|
|
|
|
|
+### cancel()
|
|
|
|
|
+To cancel a specific notification:
|
|
|
```javascript
|
|
```javascript
|
|
|
-window.plugin.notification.local.clear(__id__);
|
|
|
|
|
|
|
+window.plugin.notification.local.cancel(__id__);
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### clearAll() ###
|
|
|
|
|
-To clear all notifications:
|
|
|
|
|
|
|
+### cancelAll()
|
|
|
|
|
+To cancel all notifications:
|
|
|
```javascript
|
|
```javascript
|
|
|
-window.plugin.notification.local.clearAll();
|
|
|
|
|
|
|
+window.plugin.notification.local.cancelAll();
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-#### Example ####
|
|
|
|
|
|
|
+#### Example
|
|
|
```javascript
|
|
```javascript
|
|
|
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({
|
|
window.plugin.notification.local.add({
|
|
|
- date: _60_seconds_from_now,
|
|
|
|
|
- message: 'Hello world!',
|
|
|
|
|
- repeat: 'weekly', // will fire every week on this day
|
|
|
|
|
- badge: 1,
|
|
|
|
|
|
|
+ date: _60_seconds_from_now,
|
|
|
|
|
+ message: 'Hello world!',
|
|
|
|
|
+ repeat: 'weekly', // will fire every week on this day
|
|
|
foreground: 'foreground',
|
|
foreground: 'foreground',
|
|
|
- background: 'background',
|
|
|
|
|
- sound: 'sub.caf'
|
|
|
|
|
|
|
+ background: 'background'
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function foreground (id) {
|
|
function foreground (id) {
|