Commit c0ceca02 by Sebastián Katzer

Merge branch 'master' of github.com:katzer/cordova-plugin-local-notifications

parents 2a4c92dd f0de5c0f
...@@ -97,17 +97,20 @@ window.plugin.notification.local.cancelAll(); ...@@ -97,17 +97,20 @@ window.plugin.notification.local.cancelAll();
``` ```
## Example ## Examples
```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);
/**
* Will fire every week on this day, 60 seconds from now.
*/
window.plugin.notification.local.add({ window.plugin.notification.local.add({
id: 1, // is converted to a string id: 1, // is converted to a string
title: 'Great app!',
message: 'Reminder',
repeat: 'Dont forget to buy some flowers.',
date: _60_seconds_from_now, date: _60_seconds_from_now,
message: 'Hello world!',
title: 'Check that out!',
repeat: 'weekly', // will fire every week on this day
foreground: 'foreground', foreground: 'foreground',
background: 'background' background: 'background'
}); });
...@@ -120,10 +123,22 @@ function background (id) { ...@@ -120,10 +123,22 @@ function background (id) {
console.log('I WAS IN THE BACKGROUND ID='+id) console.log('I WAS IN THE BACKGROUND ID='+id)
} }
``` ```
```javascript
/**
* Pop's up immediately
*/
window.plugin.notification.local.add({ message: 'Great app!' });
```
```javascript
/**
* Plays no sound if the notification pop's up
*/
window.plugin.notification.local.add({ sound: null });
```
## Platform specifics ## Platform specifics
### Notification icon under Android ### Notification icon on Android
By default all notifications will display the app icon. But an specific icon can be defined through the `icon` property. By default all notifications will display the app icon. But an specific icon can be defined through the `icon` property.
```javascript ```javascript
/** /**
...@@ -137,37 +152,32 @@ window.plugin.notification.local.add({ icon: 'ic_launcher' }); ...@@ -137,37 +152,32 @@ window.plugin.notification.local.add({ icon: 'ic_launcher' });
window.plugin.notification.local.add({ icon: 'ic_dialog_email' }); window.plugin.notification.local.add({ icon: 'ic_dialog_email' });
``` ```
### Notification sound under Android ### Notification sound on Android
The default sound is `RingtoneManager.TYPE_NOTIFICATION`. But an specific sound can be defined through the `sound` property.<br> The default sound is `RingtoneManager.TYPE_NOTIFICATION`. But an specific sound can be defined through the `sound` property.<br>
The sound must be a absolute or relative Uri pointing to the sound file. The sound must be a absolute or relative Uri pointing to the sound file.
```javascript ```javascript
/** /**
* Plays the sound if the notification pop's up. * Plays the sound if the notification pop's up
*/ */
window.plugin.notification.local.add({ sound: 'res/sounds/beep.mp3' }); window.plugin.notification.local.add({ sound: 'res/sounds/beep.mp3' });
/** /**
* Plays the `RingtoneManager.TYPE_ALARM` sound. * Plays the `RingtoneManager.TYPE_ALARM` sound
*/ */
window.plugin.notification.local.add({ sound: 'TYPE_ALARM' }); window.plugin.notification.local.add({ sound: 'TYPE_ALARM' });
/**
* Plays no sound if the notification pop's up.
*/
window.plugin.notification.local.add({ sound: null });
``` ```
### Notification sound under iOS ### Notification sound on iOS
The sound must be located in your project's resources and must be a caf file. The sound must be located in your project's resources and must be a caf file.
```javascript ```javascript
/** /**
* Plays the sound if the notification pop's up. * Plays the sound if the notification pop's up
*/ */
window.plugin.notification.local.add({ sound: 'sub.caf' }); window.plugin.notification.local.add({ sound: 'sub.caf' });
``` ```
**Note:** The right to play notification sounds in the notification center settings has to be granted. **Note:** The right to play notification sounds in the notification center settings has to be granted.
### LiveTile background images under WP8 ### LiveTile background images on WP8
LiveTile's have the ability to display images for different sizes. These images can be defined through the `smallImage`, `image` and `wideImage` properties.<br> LiveTile's have the ability to display images for different sizes. These images can be defined through the `smallImage`, `image` and `wideImage` properties.<br>
An image must be defined as a relative or absolute URI. An image must be defined as a relative or absolute URI.
```javascript ```javascript
...@@ -182,10 +192,10 @@ All images can be restored to the default ones by canceling the notification. ...@@ -182,10 +192,10 @@ All images can be restored to the default ones by canceling the notification.
## Quirks ## Quirks
### No sound is played on iOS 7 ### No sound is played on iOS 7
The right to play notification sounds in the notification center settings has to be granted. The right to play notification sounds in the notification center settings has to be granted.
### Adding a notification under WP8 ### Adding a notification on WP8
An application can only display one notification at a time. Each time a new notification has to be added, the application live tile's data will be overwritten by the new ones. An application can only display one notification at a time. Each time a new notification has to be added, the application live tile's data will be overwritten by the new ones.
### Canceling a notification under WP8 ### Canceling a notification on WP8
The methods `cancel` and `cancelAll` have the same effect. The methods `cancel` and `cancelAll` have the same effect.
......
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