Android: detect when ADB is active via USB

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

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

Thanks!

+4
source share
1 answer
Settings.Global.getInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, 0); 

Should return 1 if adb is active on the phone, and 0 if it is not.

+3
source

Source: https://habr.com/ru/post/1482624/


All Articles