Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check usb debugging enabled programmatically?

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?

like image 354
Neji Avatar asked Sep 10 '13 10:09

Neji


People also ask

How do I know if I have USB debugging?

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.

How do I know if USB debugging is enabled ADB?

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.

How can I tell if USB debugging is enabled on a locked phone?

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.


1 Answers

Try this:

if(Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1) {
    // debugging enabled 
} else {
    //;debugging does not enabled
}
like image 124
DrMartens Avatar answered Sep 21 '22 17:09

DrMartens