Add the plugin to an Android Cordova project
Overview
The CONTXTFUL plugin includes the CONTXTFUL SDK any Android build of a Apache Cordova project.
Adding to a Cordova project
Unzip the cordova-plugin-contxtful.zip file.
Put the
cordova-plugin-contxtful/
folder andandroid.json
in theplugins/
folder of your project.Edit
android.json
, replacePACKAGE_NAME
withid
of the application found in theconfig.xml
file of the project.
Connecting the plugin to the Activity
Modify the main index.js
file under www/js/
like this :
function onSuccess(str){
// Your code here!
}
function onError(ErrStr){
// Your code here!
}
var app = {
// Application Constructor
initialize: function() {
navigator.ContxtfulManager.start(onSuccess, onError);
},
};
app.initialize();
Running the project
Run the following command in a terminal in your project
sudo rm -r platforms/
sudo cordova platform add android
sudo chown -R $USER:$USER platforms/
cordova build android
cordova run android
Or follow your preferred project building process!
Note : The current version of the CONTXTFUL plugin for Apache Cordova only supports Android.