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) {                }            }        }    }

 

更多相关文章

  1. Android控制手电筒代码,简单易用,不需要任何权限
  2. 4.11笔记 android database打开方式,ios反射
  3. android用户界面-组件Widget-画廊视图Gallery
  4. android studio的Gradle一直在sync的办法,不停的下载各种文件
  5. 从NDK在非Root手机上的调试原理探讨Android的安全机制
  6. Android的调试原理
  7. android log
  8. Android(安卓)发布可穿戴设备 SDK 的开发者预览版
  9. Android(安卓)LCD(四):LCD驱动调试篇

随机推荐

  1. android 开发提速
  2. Android进程间通信IPC机制Binder
  3. android 操作sdcard中的多媒体文件(一)——
  4. Android(安卓)Studio 3.6 正式版终于发布
  5. Android高性能编程
  6. android开机动画制作与播放原理简介
  7. Android的系统架构
  8. Android系列教程之Android项目的目录结构
  9. android Widget添加过程和android添加wid
  10. Android核心分析(17) ------电话系统之rilD