Skip to content
Permalink
Browse files
Resolve conflicts, merging #23 Added basic Android support for hardwa…
…re serial number
  • Loading branch information
purplecabbage committed Oct 26, 2015
2 parents 09a215b + e26f544 commit 408c3a20be976ca5b814c9f161c31d4edf1c00fc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
@@ -42,6 +42,7 @@ Although the object is in the global scope, it is not available until after the
- device.uuid
- device.version
- device.isVirtual
- device.serial

## device.cordova

@@ -228,3 +229,14 @@ whether the device is running on a simulator.
- 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

@@ -75,6 +75,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
r.put("model", this.getModel());
r.put("manufacturer", this.getManufacturer());
r.put("isVirtual", this.isVirtual());
r.put("serial", this.getSerialNumber());
callbackContext.success(r);
}
else {
@@ -126,6 +127,12 @@ public String getManufacturer() {
String manufacturer = android.os.Build.MANUFACTURER;
return manufacturer;
}

public String getSerialNumber() {
String serial = android.os.Build.SERIAL;
return serial;
}

/**
* Get the OS version.
*
@@ -71,6 +71,11 @@ exports.defineAutoTests = function() {
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);

This comment has been minimized.

Copy link
@alsorokin

alsorokin Oct 27, 2015

Contributor

@purplecabbage looks like you've missed closing brackets here.
here is the fix: #43

This comment has been minimized.

Copy link
@purplecabbage

purplecabbage Oct 27, 2015

Author Contributor

Ugh. Oops. Sorry, and thanks!

});

});
@@ -43,6 +43,7 @@ function Device() {
this.model = null;
this.manufacturer = null;
this.isVirtual = null;
this.serial = null;

var me = this;

@@ -59,6 +60,7 @@ function Device() {
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;

0 comments on commit 408c3a2

Please sign in to comment.