I want to use this cordova plugin at https://github.com/katzer/cordova-plugin-local-notifications
How to go about integrating this plugin with my existing IBM Workli
I got this to work by following the below.
Demo project: https://www.dropbox.com/s/58urdluauc8u3l1/AndroidLocalNotifications.zip
Because Worklight does not support Cordova's Plugman to easily "install" Cordova v3 plug-ins, some manual labor is required to get it all set-up properly... blachs.
Note the appName , it is used throughout the process for plug-in declarations. If you use a different name for in your app, you will need to update the values accordingly with yours.
Pay attention to the nativeResources
folder, where I've placed the files I edited:
head
element<script src="js/local-notification.js"></script>
In main.js:
function wlCommonInit(){
window.plugin.notification.local.add({ message: 'this is a local notification' });
}
The above will send a local notification immediately after the application's launch.
In the plug-in's homepage you can read more about the possible notification options.
In local-notification.js:
cordova.define("LocalNotification", function(require, exports, module) {
});
In the generated Android project\assets\www\default\js\worklight\cordova_plugins.js, add:
,
{
"file": "../js/local-notification.js",
"id": "LocalNotification",
"clobbers": [
"plugin.notification.local"
]
}
Note that re-building the Worklight project will overwrite this file, and thus your changes in it will be gone... you'll need to repeat this step after every build.
There is no good way that I could find to preserve changes to this file between Worklight Studio builds.