Tagged 1.6rc1

This commit is contained in:
Joe Bowser 2012-03-23 14:30:18 -07:00
parent 9d26598334
commit 9d0e8fa436
2 changed files with 109 additions and 109 deletions

View File

@ -1 +1 @@
1.5.0 1.6.0rc1

View File

@ -38,73 +38,73 @@ import android.telephony.TelephonyManager;
public class Device extends Plugin { public class Device extends Plugin {
public static final String TAG = "Device"; public static final String TAG = "Device";
public static String cordovaVersion = "1.5.0"; // Cordova version public static String cordovaVersion = "1.6.0rc1"; // Cordova version
public static String platform = "Android"; // Device OS public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID public static String uuid; // Device UUID
BroadcastReceiver telephonyReceiver = null; BroadcastReceiver telephonyReceiver = null;
/** /**
* Constructor. * Constructor.
*/ */
public Device() { public Device() {
} }
/** /**
* Sets the context of the Command. This can then be used to do things like * Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity. * get file paths associated with the Activity.
* *
* @param ctx The context of the main Activity. * @param ctx The context of the main Activity.
*/ */
public void setContext(CordovaInterface ctx) { public void setContext(CordovaInterface ctx) {
super.setContext(ctx); super.setContext(ctx);
Device.uuid = getUuid(); Device.uuid = getUuid();
this.initTelephonyReceiver(); this.initTelephonyReceiver();
} }
/** /**
* Executes the request and returns PluginResult. * Executes the request and returns PluginResult.
* *
* @param action The action to execute. * @param action The action to execute.
* @param args JSONArry of arguments for the plugin. * @param args JSONArry of arguments for the plugin.
* @param callbackId The callback id used when calling back into JavaScript. * @param callbackId The callback id used when calling back into JavaScript.
* @return A PluginResult object with a status and message. * @return A PluginResult object with a status and message.
*/ */
public PluginResult execute(String action, JSONArray args, String callbackId) { public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult.Status status = PluginResult.Status.OK; PluginResult.Status status = PluginResult.Status.OK;
String result = ""; String result = "";
try { try {
if (action.equals("getDeviceInfo")) { if (action.equals("getDeviceInfo")) {
JSONObject r = new JSONObject(); JSONObject r = new JSONObject();
r.put("uuid", Device.uuid); r.put("uuid", Device.uuid);
r.put("version", this.getOSVersion()); r.put("version", this.getOSVersion());
r.put("platform", Device.platform); r.put("platform", Device.platform);
r.put("name", this.getProductName()); r.put("name", this.getProductName());
r.put("cordova", Device.cordovaVersion); r.put("cordova", Device.cordovaVersion);
//JSONObject pg = new JSONObject(); //JSONObject pg = new JSONObject();
//pg.put("version", Device.CordovaVersion); //pg.put("version", Device.CordovaVersion);
//r.put("cordova", pg); //r.put("cordova", pg);
return new PluginResult(status, r); return new PluginResult(status, r);
} }
return new PluginResult(status, result); return new PluginResult(status, result);
} catch (JSONException e) { } catch (JSONException e) {
return new PluginResult(PluginResult.Status.JSON_EXCEPTION); return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
} }
} }
/** /**
* Identifies if action to be executed returns a value and should be run synchronously. * Identifies if action to be executed returns a value and should be run synchronously.
* *
* @param action The action to execute * @param action The action to execute
* @return T=returns value * @return T=returns value
*/ */
public boolean isSynch(String action) { public boolean isSynch(String action) {
if (action.equals("getDeviceInfo")) { if (action.equals("getDeviceInfo")) {
return true; return true;
} }
return false; return false;
} }
/** /**
* Unregister receiver. * Unregister receiver.
@ -156,59 +156,59 @@ public class Device extends Plugin {
this.ctx.registerReceiver(this.telephonyReceiver, intentFilter); this.ctx.registerReceiver(this.telephonyReceiver, intentFilter);
} }
/** /**
* Get the OS name. * Get the OS name.
* *
* @return * @return
*/ */
public String getPlatform() { public String getPlatform() {
return Device.platform; return Device.platform;
} }
/** /**
* Get the device's Universally Unique Identifier (UUID). * Get the device's Universally Unique Identifier (UUID).
* *
* @return * @return
*/ */
public String getUuid() { public String getUuid() {
String uuid = Settings.Secure.getString(this.ctx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); String uuid = Settings.Secure.getString(this.ctx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
return uuid; return uuid;
} }
/** /**
* Get the Cordova version. * Get the Cordova version.
* *
* @return * @return
*/ */
public String getCordovaVersion() { public String getCordovaVersion() {
return Device.cordovaVersion; return Device.cordovaVersion;
} }
public String getModel() { public String getModel() {
String model = android.os.Build.MODEL; String model = android.os.Build.MODEL;
return model; return model;
} }
public String getProductName() { public String getProductName() {
String productname = android.os.Build.PRODUCT; String productname = android.os.Build.PRODUCT;
return productname; return productname;
} }
/** /**
* Get the OS version. * Get the OS version.
* *
* @return * @return
*/ */
public String getOSVersion() { public String getOSVersion() {
String osversion = android.os.Build.VERSION.RELEASE; String osversion = android.os.Build.VERSION.RELEASE;
return osversion; return osversion;
} }
public String getSDKVersion() { public String getSDKVersion() {
String sdkversion = android.os.Build.VERSION.SDK; String sdkversion = android.os.Build.VERSION.SDK;
return sdkversion; return sdkversion;
} }
public String getTimeZoneID() { public String getTimeZoneID() {
TimeZone tz = TimeZone.getDefault(); TimeZone tz = TimeZone.getDefault();