命令开启usb调试

settings put global adb_enabled 1

settings 是在android /usr/bin/下,可以通过命令设置一些常用的设置

代码里设置

Settings.Global.putInt(this.getActivity().getContentResolver(), "adb_enabled", 1);

但是app需要有系统应用的权限:

    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

Reference

Android Shell Tricks: Using Mass Provisioning as an Example, Part 3

探究下 Android4.2 中新增的 settings 命令

Settings.Global


文章版权归 FindHao 所有丨本站默认采用CC-BY-NC-SA 4.0协议进行授权|
转载必须包含本声明,并以超链接形式注明作者 FindHao 和本文原始地址:
https://www.findhao.net/easycoding/2184.html

Comments

comments powered by Disqus