public static final String FIELD_VERSION = "version";
public static final String ACTION_GET_DEVICE_INFO = "getDeviceInfo";
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());
}
}
return result;
}