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
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
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
.
On my Android 2.3 device it is possible to detect the usb debugging mode by scanning the complete process list (ps -s
) for the process /sbin/adbd
.
If this process is present USB debugging is enabled.