Resolve conflicts, merging #23 Added basic Android support for hardware serial number
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/408c3a20 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/408c3a20 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/408c3a20 Branch: refs/heads/master Commit: 408c3a20be976ca5b814c9f161c31d4edf1c00fc Parents: 09a215b e26f544 Author: Jesse MacFadyen <[email protected]> Authored: Mon Oct 26 16:19:51 2015 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Mon Oct 26 16:48:40 2015 -0700 ---------------------------------------------------------------------- README.md | 12 ++++++++++++ src/android/Device.java | 7 +++++++ tests/tests.js | 5 +++++ www/device.js | 2 ++ 4 files changed, 26 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/408c3a20/README.md ---------------------------------------------------------------------- diff --cc README.md index 34e099f,b439f12..06041a2 --- a/README.md +++ b/README.md @@@ -41,7 -40,7 +41,8 @@@ Although the object is in the global sc - device.platform - device.uuid - device.version +- device.isVirtual + - device.serial ## device.cordova @@@ -216,15 -219,12 +217,26 @@@ Get the operating system version // Tizen: returns "TIZEN_20120425_2" var deviceVersion = device.version; +## device.isVirtual + +whether the device is running on a simulator. + + var isSim = device.isVirtual; + +### Supported Platforms + +- Android 2.1+ +- iOS +- Windows Phone 8 + ++ + ## device.serial + + Get the device hardware serial number ([SERIAL](http://developer.android.com/reference/android/os/Build.html#SERIAL)). + + var string = device.serial; + + ### Supported Platforms + + - Android ++ http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/408c3a20/src/android/Device.java ---------------------------------------------------------------------- diff --cc src/android/Device.java index ecfe447,305ed66..e9efcb4 --- a/src/android/Device.java +++ b/src/android/Device.java @@@ -74,7 -74,7 +74,8 @@@ public class Device extends CordovaPlug 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 { http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/408c3a20/tests/tests.js ---------------------------------------------------------------------- diff --cc tests/tests.js index 7bf5c04,a9544a9..b46af2b --- a/tests/tests.js +++ b/tests/tests.js @@@ -68,9 -68,9 +68,14 @@@ exports.defineAutoTests = function() expect((new String(window.device.manufacturer)).length > 0).toBe(true); }); + it("should contain an isVirtual property that is a boolean", function() { + expect(window.device.isVirtual).toBeDefined(); + expect(typeof window.device.isVirtual).toBe("boolean"); ++ + it("should contain a serial number specification that is a string", function() { + expect(window.device.serial).toBeDefined(); + expect((new String(window.device.serial)).length > 0).toBe(true); ++ }); }); http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/408c3a20/www/device.js ---------------------------------------------------------------------- diff --cc www/device.js index 9997f5f,55af80c..83b57d4 --- a/www/device.js +++ b/www/device.js @@@ -42,7 -42,7 +42,8 @@@ function Device() this.cordova = null; this.model = null; this.manufacturer = null; + this.isVirtual = null; + this.serial = null; var me = this; @@@ -57,8 -57,8 +58,9 @@@ me.uuid = info.uuid; me.cordova = buildLabel; me.model = info.model; + me.isVirtual = info.isVirtual; me.manufacturer = info.manufacturer || 'unknown'; + me.serial = info.serial || 'unknown'; channel.onCordovaInfoReady.fire(); },function(e) { me.available = false; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
