Search code examples
androiddebuggingusb

Is it possible to detect the USB-debugging on android devices?


in my app i need a way to detect if the android-device runs in usb-debugging mode.

Is it possible? If yes, how?

thanx in advance


Solution

  • You can use the following to get whether or not the ADB is enabled.

    int adb = Settings.Secure.getInt(context.getContentResolver(),  Settings.Global.ADB_ENABLED, 0);
    

    If it is enabled, adb == 1, otherwise adb == 0.