I need to implement PubNub pushnotification in my MobileFirst project.
For that implementation i done the following things.
In my android native folder :assets->www->default->worklight->cordova_plugins.js
Here I added the following code
{
"file": "plugins/org.apache.cordova.pushnotification/www/pushnotification.js",
"merges": [
"window.plugins.pushNotification"
]
}
In android native folder assets->www->default->js->main.js file i added the following code
var pushNotification = window.plugins.pushNotification;
pushNotification.register(
successHandler,
errorHandler,
{
'senderID':'projectID'
}
);
function successHandler(result) {
alert('Success: '+ result);
}
function errorHandler(error) {
alert('Error: '+ error);
}
And I run this code on my android device. When I inspect my android device. i am getting the following error on my concole
Uncaught Error: Module undefined does not exist. in cordova.js file
Is this cordova plugin issue?
How can I configure cordova plugin in MobileFirst project?
Please suggest..
You should not edit main.js in the native\\www folder.
You need to edit the main.js that is in apps\\your-app\\common\\js\\main.js. This file is later copied into the native folder.
If you edit the file in the native folder and then build the project, your changes are lost - they will be overwritten with what that is in common\\js\\main.js...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.