ricci69 / push-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:Apache License 2.0


Languages

Language:JavaScript 72.9%Language:Java 9.7%Language:Objective-C 8.1%Language:C++ 5.2%Language:HTML 2.2%Language:Batchfile 0.7%Language:CSS 0.6%Language:C# 0.2%Language:PowerShell 0.2%Language:C 0.1%Language:Shell 0.0%Language:M 0.0%Language:Mercury 0.0%