[英]Determine usb debugging enabled or not when connected with device
HI i am working with xamarin android i am trying to determine using my app that when my app connected with device USB debugging enabled or not i am trying to use below code but cannot find 嗨,我正在使用xamarin android,我试图确定使用我的应用程序时,当我的应用程序连接了设备USB调试功能时,我试图使用以下代码,但找不到
Settings.Secure
I want to use below code 我想使用下面的代码
int adb = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
Please if i am right how can i use it in my project if not then what's the other way 如果我是对的,请问我如何在我的项目中使用它?
Settings.Secure.AdbEnabled
and Settings.System.AdbEnabled
were deprecated in API 17 and moved to Global
在API 17中已弃用Settings.Secure.AdbEnabled
和Settings.System.AdbEnabled
并将其移到Global
int adb = Settings.Global.GetInt(ContentResolver, Settings.Global.AdbEnabled, 0);
Ref: ADB_ENABLED 参考: ADB_ENABLED
Note: This does not determine if the Debug Bridge is active or not. 注意:这不能确定调试桥是否处于活动状态。
If you are looking for when a debugger is attached you can use: 如果您正在寻找附加调试器的时间,则可以使用:
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.