Skip to content

coderroggie/cordova-plugin-local-notifications

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayPayl donate button

Cordova Local-Notification - Example

Cordova plugin to enable an app that isn’t running in the foreground to let its users know it has information for them. The information could be a message, an impending calendar event, or new data on a remote server. They can display an alert message or they can badge the app icon. They can also play a sound when the alert or badge number is shown.

Instructions

Download or clone the example branch and run the following command:

cordova run [ios|android|windows]

These will lunch the simulator or any plugged in device and start the example application as seen below in the screenshots.
Its also possible to open and debug the project with Xcode, VS Express for Windows, Android Studio or Eclipse.

Scroll down to see more buttons!

The following code snippet will schedule a local notification every day wich will be displayed within the notification center.

cordova.plugins.notification.local.schedule({
    id: 1,
    text: 'My first notification',
    sound: isAndroid ? 'file://sound.mp3' : 'file://beep.caf',
    every: 'day',
    firstAt: next_monday,
    data: { key:'value' }
})

This also fires various callbacks like trigger or click for which you can listen as follows:

cordova.plugins.notification.local.on('trigger', function (notification) {
    showToast('triggered: ' + notification.id);
}, this);

cordova.plugins.notification.local.on('click', function (notification) {
    showToast('clicked: ' + notification.id);
}, this);

Please read the plugin's README for further requirements and informations.

iOS8 Permission

Since iOS8 to use of local noficiations the user has to grant the permission before trying to schedule them. When trying to schedule a notification for the first time, a special system dialog will popup.

Note that iOS will only prompt the user only once! Later the user needs to configure the settings manually.

Screenshots

The following screenshots give an overview of how the notification center on each mobile platform does look like when scheduling multiple local notifications at once.

   

How can I support the further development?

Your support is needed. If you use the plugin please send us a drop through the donation button.

Thank you!

PayPayl donate button

License

This software is released under the Apache 2.0 License.

© 2013-2015 appPlant UG, Inc. All rights reserved

About

Cordova Local-Notification Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 46.2%
  • JavaScript 30.1%
  • Objective-C 23.7%