The plugin is simple, a function "get" in JavaScript is created and it returns data of type JSON.
To install from the Cordova CLI:
cordova plugin add cordova-plugin-privatevar
In the Java file in app Project /src/java/com/sistepar/cordova/plugin/PrivatevarPlugin.java you can add all the data that you want to be returned in Json.
/* Edit here to return data in json */
json.put("apiUrl", "https://api.sistepar.com");
json.put("apiKey", "12345678");
From the Xcode we enter the Plugins folder then PrivateVar.m and in the getDatasToReturn() method we modify the datas to return.
/* Edit here to return data in json */
return @{
@"apiUrl": @"https://api.sistepar.com",
@"apiKey": @"12345",
};
To use it from Cordova inside the deviceredy event.
/* Call the plugin */
cordova.plugins.privatevar.get(function(data){
alert(JSON.stringify(data));
});
License: The MIT License
Made By sistepar.com