Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Detect when ADB active over USB

Tags:

android

adb

Is it possible to have an application detect when ADB is listening over USB on an Android phone?

I'm looking for something like this: Is it possible to determine whether an Android device is plugged into a computer or just power? but specifically for when ADB is running.

Thanks!

like image 325
lanrat Avatar asked May 24 '13 18:05

lanrat


1 Answers

Settings.Global.getInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, 0);

Will return a 1 if USB Debugging is enabled on the phone and a 0 if it isn't.

like image 91
Jcooke Avatar answered Sep 28 '22 08:09

Jcooke