I've encountered an issue with programmatically validating USB-Debugging option with disabled Developer Options. Is it possible?

Viewed 31

In my android application I've added a check for USB-Debugging. I've found an issue with a specific device model where USB-Debugging was enabled even though Developer Option is disabled.

The code sample was from

if (Settings.Secure.getInt(this.getContentResolver(), Settings.Global.ADB_ENABLED, 0) == 1) {
      Toast.makeText(this, "ADB_ENABLED enabled", Toast.LENGTH_SHORT).show();
} else {
      Toast.makeText(this, "ADB_ENABLED not enabled", Toast.LENGTH_SHORT).show();
}

Once I manually re-closed the USB-Debugging only then the code was working normally. The device was Oppo A53 with Android Version 11 and Color OS Version 11.1. Does anybody have encountered such error? How can we overcome this kind of situation if arises in future. Please help.

0 Answers
Related