문제

my question is on an Android phone how can I check if the usb debugging flag is enabled or not programmatically? in my application I want to show the status of usb debugging and I want to get it programmatically

How can I get if usb debugging is enabled programmatically?

도움이 되었습니까?

해결책

Try this:

if(Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1) {
    // debugging enabled 
} else {
    //;debugging does not enabled
}

다른 팁

Simple:

   boolean isDebuggable =  ( 0 != ( getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ));

And if you want to check if it is connected:

if (!Debug.isDebuggerConnected()){
   //Yes, it is.
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top