Skip to content

Commit

Permalink
Implement the changes in getting serial (Api_level 26)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebLevDev committed Sep 1, 2021
1 parent dc7b39b commit 70f33ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<param name="android-package" value="org.apache.cordova.device.Device"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
</config-file>

<source-file src="src/android/Device.java" target-dir="src/org/apache/cordova/device" />
</platform>
Expand Down
11 changes: 10 additions & 1 deletion src/android/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@ public String getManufacturer() {
}

public String getSerialNumber() {
String serial = android.os.Build.SERIAL;
String serial;
int sdk_int = android.os.Build.VERSION.SDK_INT;
if (sdk_int < 26) {
serial = android.os.Build.SERIAL;
}
else {
serial = android.os.Build.getSerial();
}


return serial;
}

Expand Down

0 comments on commit 70f33ae

Please sign in to comment.