Android 检测辅助功能是否开启,并调整设置页面
来源:互联网 发布:4d软件下载 编辑:程序博客网 时间:2024/04/29 23:29
if (!isAccessibilitySettingsOn(mContext)) { Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); startActivity(intent); }
判断是否开启,如果没有开启,则跳转页面
/** * 检测辅助功能是否开启<br> * 方 法 名:isAccessibilitySettingsOn <br> * 创 建 人 <br> * 创建时间:2016-6-22 下午2:29:24 <br> * 修 改 人: <br> * 修改日期: <br> * @param mContext * @return boolean */ private boolean isAccessibilitySettingsOn(Context mContext) { int accessibilityEnabled = 0; // TestService为对应的服务 final String service = getPackageName() + "/" + TestService.class.getCanonicalName(); Log.i(TAG, "service:" + service); // com.z.buildingaccessibilityservices/android.accessibilityservice.AccessibilityService try { accessibilityEnabled = Settings.Secure.getInt(mContext.getApplicationContext().getContentResolver(), android.provider.Settings.Secure.ACCESSIBILITY_ENABLED); Log.v(TAG, "accessibilityEnabled = " + accessibilityEnabled); } catch (Settings.SettingNotFoundException e) { Log.e(TAG, "Error finding setting, default accessibility to not found: " + e.getMessage()); } TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':'); if (accessibilityEnabled == 1) { Log.v(TAG, "***ACCESSIBILITY IS ENABLED*** -----------------"); String settingValue = Settings.Secure.getString(mContext.getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); // com.z.buildingaccessibilityservices/com.z.buildingaccessibilityservices.TestService if (settingValue != null) { mStringColonSplitter.setString(settingValue); while (mStringColonSplitter.hasNext()) { String accessibilityService = mStringColonSplitter.next(); Log.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service); if (accessibilityService.equalsIgnoreCase(service)) { Log.v(TAG, "We've found the correct setting - accessibility is switched on!"); return true; } } } } else { Log.v(TAG, "***ACCESSIBILITY IS DISABLED***"); } return false; }
阅读全文
0 0
- Android 检测辅助功能是否开启,并调整设置页面
- Android 检测辅助功能是否开启,并调整设置页面
- Android检测辅助功能是否开启
- 检测是否开启推送通知功能
- android检测某一个线程是否开启
- android检测某个服务是否开启
- Android 检测服务是否开启的方法
- 在插件中增加检测防火墙是否开启的功能
- IOS检测网络并打开设置页面
- 检测蓝牙是否开启
- android 调用设置页面开启gps
- ios 判断用户是否开启定位权限并跳转设置
- 开启Android程序时检测网络与GPS是否打开
- 开启Android程序时检测网络与GPS是否打开
- 开启Android程序时检测网络与GPS是否打开
- 开启Android程序时检测网络与GPS是否打开
- 开启Android程序时检测网络与GPS是否打开
- Android之检测GPS服务和定位权限是否开启
- 软件工程课程设计问题总结——医院门诊系统(四):后台获取下拉列表的值并在页面中显示
- 单链表成环问题
- Docker镜像导出、导入
- mysql 5.7 安装及修改/重置密码
- 从谷歌官方示例谈MVP设计模式
- Android 检测辅助功能是否开启,并调整设置页面
- Codeforces Round #422 (Div. 2)
- Nutz中那些好用的工具类
- 深度学习的认识
- c# 简单执行Post
- rpm包解压时遇到存在依赖项的问题
- 【Python】Struct2 探测工具
- 制作电子相册
- 微信小程序开发系列——4.小程序视图页面基础知识