From ef4f212fc1482136dba1e690ec589b315b4a377f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 8 Nov 2016 12:37:03 -0500 Subject: build 0.7.0 --- .../cordova-plugin-device/src/android/Device.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) mode change 100755 => 100644 StoneIsland/plugins/cordova-plugin-device/src/android/Device.java (limited to 'StoneIsland/plugins/cordova-plugin-device/src/android/Device.java') diff --git a/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java b/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java old mode 100755 new mode 100644 index 5eded907..e9efcb49 --- a/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java +++ b/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java @@ -67,13 +67,15 @@ public class Device extends CordovaPlugin { * @return True if the action was valid, false if not. */ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - if (action.equals("getDeviceInfo")) { + if ("getDeviceInfo".equals(action)) { JSONObject r = new JSONObject(); r.put("uuid", Device.uuid); r.put("version", this.getOSVersion()); r.put("platform", this.getPlatform()); r.put("model", this.getModel()); r.put("manufacturer", this.getManufacturer()); + r.put("isVirtual", this.isVirtual()); + r.put("serial", this.getSerialNumber()); callbackContext.success(r); } else { @@ -88,7 +90,7 @@ public class Device extends CordovaPlugin { /** * Get the OS name. - * + * * @return */ public String getPlatform() { @@ -125,6 +127,12 @@ public class Device extends CordovaPlugin { String manufacturer = android.os.Build.MANUFACTURER; return manufacturer; } + + public String getSerialNumber() { + String serial = android.os.Build.SERIAL; + return serial; + } + /** * Get the OS version. * @@ -148,7 +156,7 @@ public class Device extends CordovaPlugin { /** * Function to check if the device is manufactured by Amazon - * + * * @return */ public boolean isAmazonDevice() { @@ -158,4 +166,9 @@ public class Device extends CordovaPlugin { return false; } + public boolean isVirtual() { + return android.os.Build.FINGERPRINT.contains("generic") || + android.os.Build.PRODUCT.contains("sdk"); + } + } -- cgit v1.2.3-70-g09d2