my question is on an Android phone how can I check if the usb debugging flag is enabled or not programmatically? in my application I want to show the status of usb debugging and I want to get it programmatically
How can I get if usb debugging is enabled programmatically?
On modern Android devices, you'll find USB Debugging in the Developer Options menu, which is hidden by default. To unlock it, head to Settings and scroll down to About phone. Scroll down again on the next menu, and you'll see a Build number entry at the bottom.
Enable adb debugging on your device To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom. On some devices, the Developer options screen might be located or named differently. You can now connect your device with USB.
Turn on Enable USB Debugging on Android Here is how to do it; Open the Settings menu on your phone. Navigate through the menu by choosing System, then Advanced, and then Developer Mode. In Developer Mode, toggle the slider next to the USB debugging option.
Try this:
if(Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1) {
// debugging enabled
} else {
//;debugging does not enabled
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With