Commit 48176084 by PKnittel

Added a Readme

Added a Readme-File to help give people an overview.
parent b3a0457e
Cordova Local-Notification Plugin - Example
==============================
[Cordova][cordova] plugin to enable an application to inform its users about something, when the application isn’t running in the foreground. Works on various mobile platforms including iOS, Android and Windows Phone. (The Example App currently only supports android. Other Platforms will be added soon.)
## Instructions
[Download][zip] or clone the _example_ branch and run the following command:
```bash
cordova run [android]
```
These will lunch the simulator or any plugged in device and start the example application as seen below in the screenshots. It's also possible to open the project with [Android Studio][studio] or [Eclipse][eclipse].
<p align="center">
<img src="images/overview1.png"></img>
</p>
Scroll down to see more Buttons.
<p align="center">
<img src="images/overview2.png"></img>
</p>
Pushing the _"Schedule local notification"_ Button will schedule a local notification wich should be displayed immediately.
This also invokes the declared onAdd (_notification.local.onadd_) and onTrigger (_notification.local.ontrigger_) functions.
Feel free to use the example and modify it for your own application.
Please read the plugin's [README][readme] for further requirements and informations.
## Screenshots
<p align="center">
<img width="32.5%" src="images/android.png"></img>
</p>
## License
This software is released under the [Apache 2.0 License][apache2_license].
© 2013-2014 appPlant UG, Inc. All rights reserved
[cordova]: https://cordova.apache.org
[readme]: https://github.com/katzer/cordova-plugin-local-notifications/blob/master/README.md
[zip]: https://github.com/katzer/cordova-plugin-local-notifications/archive/example.zip
[xcode]: https://developer.apple.com/xcode/
[studio]: https://developer.android.com/sdk/installing/studio.html
[eclipse]: https://developer.android.com/sdk/index.html
[apache2_license]: http://opensource.org/licenses/Apache-2.0
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\CordovaLib\ant-build\AndroidManifest.xml : \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\CordovaLib\ant-build\AndroidManifest.xml : \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\CordovaLib\AndroidManifest.xml \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\CordovaLib\AndroidManifest.xml \
#Last build type #Last build type
#Thu, 11 Dec 2014 18:06:21 +0100 #Fri, 12 Dec 2014 15:04:52 +0100
build.last.target=debug build.last.target=debug
......
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\AndroidManifest.xml : \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\AndroidManifest.xml : \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\AndroidManifest.xml \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\AndroidManifest.xml \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\CordovaApp-debug-unaligned.apk : \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\CordovaApp-debug-unaligned.apk : \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\CordovaApp.ap_ \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\CordovaApp.ap_ \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes.dex \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes.dex \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\CordovaLib\ant-build\classes.jar \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\CordovaLib\ant-build\classes.jar \
C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\libs\android-support-v4.jar \
#Last build type #Last build type
#Thu, 11 Dec 2014 18:06:30 +0100 #Fri, 12 Dec 2014 15:05:02 +0100
build.last.target=debug build.last.target=debug
......
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes.dex : \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes.dex : \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$1.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$1.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$2.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$2.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$3.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$3.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$4.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$4.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$5.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification$5.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\LocalNotification.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Options.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Options.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Receiver.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Receiver.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\ReceiverActivity.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\ReceiverActivity.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Restore.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\localnotification\Restore.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\BuildConfig.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\BuildConfig.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\CordovaApp.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\CordovaApp.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$attr.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$attr.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$drawable.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$drawable.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$string.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$string.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$xml.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R$xml.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\de\appplant\cordova\plugin\local_notification\example\R.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\classes\org\apache\cordova\device\Device.class \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\classes\org\apache\cordova\device\Device.class \
C:\Users\Philipp\Documents\workspaces\app-Plant\notificationexample\platforms\android\ant-build\dexedLibs\classes-cc4094edc9cda7bbacab42773ec0b6f6.jar \ C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\dexedLibs\classes-c50ec053a96b9ed963b7bb975f8dad4f.jar \
C:\Users\Philipp\Documents\git\AppPlant-Repo\cordova-plugin-local-notifications\platforms\android\ant-build\dexedLibs\android-support-v4-b4aaeab35b0f5390ac7dd828fd86243b.jar \
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
...@@ -95,6 +95,10 @@ ...@@ -95,6 +95,10 @@
<a href="#" class="button" onclick="cancel()">Cancel notification with id<br/><span class="hint">notification.local.cancel()</span></a> <a href="#" class="button" onclick="cancel()">Cancel notification with id<br/><span class="hint">notification.local.cancel()</span></a>
<a href="#" class="button" onclick="getScheduledIds()">Get scheduled IDs<br/><span class="hint">notification.local.getScheduledIds()</span></a> <a href="#" class="button" onclick="getScheduledIds()">Get scheduled IDs<br/><span class="hint">notification.local.getScheduledIds()</span></a>
<a href="#" class="button" onclick="isScheduled()">Is a notification scheduled?<br/><span class="hint">notification.local.isScheduled()</span></a> <a href="#" class="button" onclick="isScheduled()">Is a notification scheduled?<br/><span class="hint">notification.local.isScheduled()</span></a>
<a href="#" class="button" onclick="addWithDefault()">Schedule not. with default values<br/><span class="hint">notification.local.add(defaults)</span></a>
<a href="#" class="button" onclick="setDefaults()">Set new default values<br/><span class="hint">notification.local.setDefaults()</span></a>
<a href="#" class="button" onclick="getTriggeredIds()">Get triggered IDs<br/><span class="hint">notification.local.getTriggeredIds()</span></a>
<a href="#" class="button" onclick="isTriggered()">Is a notification triggered?<br/><span class="hint">notification.local.isTriggered()</span></a>
</div> </div>
<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="cordova.js"></script>
...@@ -104,12 +108,28 @@ ...@@ -104,12 +108,28 @@
app.initialize(); app.initialize();
var callback = function () { var callback = function () {
alert('finished or canceled'); console.log('finished or canceled');
}; };
document.addEventListener('deviceready', function () { document.addEventListener('deviceready', function () {
// window.plugin.notification.local is now available // window.plugin.notification.local is now available
window.plugin.notification.local.onadd = function (id, state, json) {
alert('on add');
};
window.plugin.notification.local.ontrigger = function (id, state, json) {
alert('on trigger');
};
window.plugin.notification.local.onclick = function (id, state, json) {
alert('on Click');
};
window.plugin.notification.local.oncancel = function (id, state, json) {
alert('on Cancel');
};
}, false); }, false);
add = function () { add = function () {
...@@ -135,16 +155,45 @@ ...@@ -135,16 +155,45 @@
getScheduledIds = function () { getScheduledIds = function () {
window.plugin.notification.local.getScheduledIds(function (scheduledIds) { window.plugin.notification.local.getScheduledIds(function (scheduledIds) {
console.log('Scheduled IDs: ' + scheduledIds.join(' ,')); alert('Scheduled IDs: ' + scheduledIds.join(' ,'));
},this); },this);
}; };
isScheduled = function () { isScheduled = function () {
window.plugin.notification.local.isScheduled(12345, function (isScheduled) { window.plugin.notification.local.isScheduled(12345, function (isScheduled) {
console.log('Notification with ID 12345 is scheduled: ' + isScheduled); alert('Notification with ID 12345 is scheduled: ' + isScheduled);
}, this);
};
addWithDefault = function () {
var defaults = window.plugin.notification.local.getDefaults();
window.plugin.notification.local.add(defaults);
};
setDefaults = function () {
var newDefaults = { id: 12344, // A unique id of the notifiction
date: _60_seconds_from_now, // This expects a date object
message: 'new defaults set', // The message that is displayed
title: 'Default Notification', // The title of the message
repeat: 'minutely', // Either 'secondly', 'minutely', 'hourly', 'daily', 'weekly', 'monthly' or 'yearly'
badge: 1, // Displays number badge to notification
autoCancel: true, // Setting this flag and the notification is automatically canceled when the user clicks it
//ongoing: true, // Prevent clearing of notification (Android only)
}
window.plugin.notification.local.setDefaults(newDefaults);
};
isTriggered = function () {
window.plugin.notification.local.isTriggered(12345, function (isTriggered) {
alert('Notification with ID 12345 is triggered: ' + isTriggered);
}, this); }, this);
}; };
getTriggeredIds = function () {
window.plugin.notification.local.getTriggeredIds(function (triggeredIds) {
alert('Triggered IDs: ' + triggeredIds.join(' ,'));
}, this);
};
</script> </script>
</body> </body>
</html> </html>
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