android Setting中幾個設置項的設置,(USB StayAwake  Locations):

直接貼代碼:

public void setUSBDebugger(){int isUSBDebugging = -1;try {isUSBDebugging = Settings.Secure.getInt(getContentResolver(), Settings.Secure.ADB_ENABLED);if(isUSBDebugging == 0){Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1);}} catch (SettingNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void setStayAwake(){int isStayAwake = -1;try {isStayAwake = Settings.System.getInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN);if(isStayAwake == 0){Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, 3);}} catch (SettingNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}}public void setLocations(){int isLocations = -1;try {isLocations = Settings.Secure.getInt(getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION);if(isLocations == 0){Settings.Secure.putInt(getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION, 1);}} catch (SettingNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 史上最全最新微信小程序自动化教程
  2. 20210221-2 软件管理与网络管理
  3. 【js效果】屏蔽鼠标右键
  4. 支付宝支付--沙箱支付教程+案例 | PC端网
  5. 20210221-3 复杂系统
  6. 20210206-1 Linux基础与应用(上)
  7. 【DB宝36】使用Docker分分钟搭建漂亮的pr
  8. vue-cli脚手架安装
  9. linux 安装rsync服务,步骤
  10. 20210211-1 Linux基础与应用(中)