zoukankan      html  css  js  c++  java
  • android判断adb调试是否打开及代码跳转到开发者选项界面

    boolean enableAdb = (Settings.Secure.getInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0) > 0);//判断adb调试模式是否打开
            if (enableAdb) {
                ToastUtil.showShort("adb调试模式已经打开");
            } else {
                startDevelopmentActivity();//跳转到开发者选项界面
            }
    
    /**
         * 打开开发者模式界面
         */
        private void startDevelopmentActivity() {
            try {
                Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
                startActivity(intent);
            } catch (Exception e) {
                try {
                    ComponentName componentName = new ComponentName("com.android.settings", "com.android.settings.DevelopmentSettings");
                    Intent intent = new Intent();
                    intent.setComponent(componentName);
                    intent.setAction("android.intent.action.View");
                    startActivity(intent);
                } catch (Exception e1) {
                    try {
                        Intent intent = new Intent("com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS");//部分小米手机采用这种方式跳转
                        startActivity(intent);
                    } catch (Exception e2) {
    
                    }
    
                }
            }
        }
  • 相关阅读:
    HBASE数据模型&扩展和负载均衡理论
    JVM Safepoint 安全点
    JVM垃圾回收算法 及 垃圾收集器
    JVM运行时数据区域
    Java IO、BIO、NIO、BIO
    Java反射
    Zookeeper
    二叉树深度
    二叉树层次遍历
    KMP算法
  • 原文地址:https://www.cnblogs.com/baiyi168/p/8135766.html
Copyright © 2011-2022 走看看