lanrat
lanrat

Reputation: 4694

Android: Detect when ADB active over USB

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!

Upvotes: 9

Views: 4484

Answers (1)

Jcooke
Jcooke

Reputation: 65

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.

Upvotes: 4

Related Questions