Package org.apache.cordova.json4j

Examples of org.apache.cordova.json4j.JSONObject


  public PluginResult execute(String action, JSONArray args, String callbackId) {
    PluginResult result = new PluginResult(PluginResult.Status.INVALID_ACTION, "Device: Invalid action:" + action);

    if(action.equals(ACTION_GET_DEVICE_INFO)){
      try {
        JSONObject device = new JSONObject();
        device.put( FIELD_PLATFORM, new String(DeviceInfo.getPlatformVersion() ) );
        device.put( FIELD_UUID, new Integer( DeviceInfo.getDeviceId()) );
        device.put( FIELD_CORDOVA, "1.5.0" );
        device.put( FIELD_NAME, new String(DeviceInfo.getDeviceName()) );
        device.put( FIELD_VERSION, new String(DeviceInfo.getSoftwareVersion()) );
        result = new PluginResult(PluginResult.Status.OK, device);
      } catch (JSONException e) {
        result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.cordova.json4j.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.