![](/img/trans.png)
[英]web application, need to determine if a USB device is connected to the client computer
[英]Determine usb debugging enabled or not when connected with device
嗨,我正在使用xamarin android,我试图确定使用我的应用程序时,当我的应用程序连接了设备USB调试功能时,我试图使用以下代码,但找不到
Settings.Secure
我想使用下面的代码
int adb = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
如果我是对的,请问我如何在我的项目中使用它?
在API 17中已弃用Settings.Secure.AdbEnabled
和Settings.System.AdbEnabled
并将其移到Global
int adb = Settings.Global.GetInt(ContentResolver, Settings.Global.AdbEnabled, 0);
参考: ADB_ENABLED
注意:这不能确定调试桥是否处于活动状态。
如果您正在寻找附加调试器的时间,则可以使用:
Log.Debug("SO", $"Java Debugger: {Android.OS.Debug.IsDebuggerConnected}");
Log.Debug("SO", $"Mono Debugger: {System.Diagnostics.Debugger.IsAttached}");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.