Skip to content
Permalink
Browse files
feat(android): getInfo response to include sdkVersion (#157)
* feat(android): getInfo response to include sdkVersion
* feat(android): sdk version appears on device object
* doc(android): add device.sdkVersion info
* doc(android): remove word installed

Co-authored-by: Norman Breau <norman@nbsolutions.ca>
  • Loading branch information
erisu and breautek committed Apr 1, 2022
1 parent 45a1316 commit d217d6ae10ce599c67304010e1c253f12b19594b
Showing 3 changed files with 13 additions and 3 deletions.
@@ -49,6 +49,7 @@ function onDeviceReady() {
- device.manufacturer
- device.isVirtual
- device.serial
- device.sdkVersion (Android only)

## device.cordova

@@ -251,6 +252,10 @@ whether the device is running on a simulator.
var isSim = device.isVirtual;
```

## device.sdkVersion (Android only)

Will return the Android device's SDK version.

### Supported Platforms

- Android
@@ -76,6 +76,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
r.put("manufacturer", this.getManufacturer());
r.put("isVirtual", this.isVirtual());
r.put("serial", this.getSerialNumber());
r.put("sdkVersion", this.getSDKVersion());
callbackContext.success(r);
}
else {
@@ -144,9 +145,7 @@ public String getOSVersion() {
}

public String getSDKVersion() {
@SuppressWarnings("deprecation")
String sdkversion = android.os.Build.VERSION.SDK;
return sdkversion;
return String.valueOf(android.os.Build.VERSION.SDK_INT);
}

public String getTimeZoneID() {
@@ -61,6 +61,12 @@ function Device () {
me.isVirtual = info.isVirtual;
me.manufacturer = info.manufacturer || 'unknown';
me.serial = info.serial || 'unknown';

// SDK Version is Android specific. If defined, it will be appended.
if (info.sdkVersion !== undefined) {
me.sdkVersion = info.sdkVersion;
}

channel.onCordovaInfoReady.fire();
},
function (e) {

0 comments on commit d217d6a

Please sign in to comment.