diff options
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-device/src/android/Device.java')
| -rw-r--r--[-rwxr-xr-x] | StoneIsland/plugins/cordova-plugin-device/src/android/Device.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java b/StoneIsland/plugins/cordova-plugin-device/src/android/Device.java index 5eded907..e9efcb49 100755..100644 --- 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"); + } + } |
