是否可以让应用程序检测 ADB 何时通过 Android 手机上的 USB 进行监听?
我正在寻找这样的东西:Is it possible to determine whether an Android device is plugged into a computer or just power?但特别适用于 ADB 运行时。
谢谢!
最佳答案
Settings.Global.getInt(context.getContentResolver(), Settings.Global.ADB_ENABLED, 0);
如果手机上启用了 USB 调试,则返回 1,否则返回 0。
关于Android:检测 ADB 何时通过 USB 激活,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16741787/