Repository URL to install this package:
package com.vipera.CordovaReadConfig;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaPreferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class CordovaReadConfig extends CordovaPlugin
{
private static final String READ_CONFIG = "readConfig";
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException
{
if (action.equals(READ_CONFIG))
{
try
{
CordovaPreferences preferences = webView.getPreferences();
JSONObject result = new JSONObject(preferences.getAll());
callbackContext.success(result);
}
catch (Exception e)
{
callbackContext.error(e.getMessage());
}
return true;
}
return false;
}
}