Skip to content

Commit

Permalink
- Added exception handler for the new SecurityException in USBDevice …
Browse files Browse the repository at this point in the history
…getSerialNumber
  • Loading branch information
Sockmonsters committed May 29, 2020
1 parent ae9ff11 commit eea450b
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -53,7 +53,13 @@ public int getProductId() {
public String getSerialNumber() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
result = mDevice.getSerialNumber();
try {
result = mDevice.getSerialNumber();
}
catch (SecurityException exception) {
Log.w(TAG, "App permissions mean we cannot get serial number for device " + getDeviceName() + " message: " + exception.getMessage());
result = "";
}
}
if (result == null) {
result = "";
Expand Down

0 comments on commit eea450b

Please sign in to comment.