是否可以让应用程序检测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。