adb控制设备状态

屏幕设置

屏幕亮度

python 复制代码
# 当前屏幕亮度
adb shell settings get system screen_brightness

# 更改屏幕亮度
 adb shell settings put system screen_brightness

屏幕休眠时间

python 复制代码
# 当前屏幕休眠时间
adb shell settings get system screen_off_timeout

#更改屏幕休眠时间
adb shell settings put system screen_off_timeout 10000

蓝牙

获取蓝牙状态

python 复制代码
# 1是开,0是关
adb shell settings get global bluetooth_on

# enabled:true是开,enabled: false是关
adb shell dumpsys bluetooth_manager | findstr enabled

设置蓝牙状态

python 复制代码
# 开启蓝牙
adb shell settings put global bluetooth_on 1
# 关闭蓝牙
adb shell settings put global bluetooth_on 0

# 这个方法重启才会生效
adb shell svc bluetooth enable
adb shell svc bluetooth disable

# 出现弹窗,点击允许后开启蓝牙
adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE

# 进入蓝牙界面,根据实际再点击页面
adb shell am start -a android.settings.BLUETOOTH_SETTINGS

# 调用appium的广播,会出现弹窗需点击
adb shell am broadcast -a io.appium.settings.bluetooth --es setstatus enable

WiFi和热点

获取网络状态

python 复制代码
# windows系统用findstr,linux系统用grep
adb shell ps | findstr wifi
python 复制代码
# 有wpa_supplicant就表示wifi开启,有hostapd就表示热点开启
wifi            626      1   13992   3280 0                   0 S [email protected]
wifi           1016      1   15264   2944 0                   0 S wificond
wifi           4961      1   23880   7944 0                   0 S wpa_supplicant
wifi           5027      1   13384   4936 0                   0 S hostapd

设置WiFi状态

python 复制代码
# 打开WiFi
adb shell svc wifi enable  

#关闭WiFi
adb shell svc wifi disable  

设置热点状态

python 复制代码
# 进入热点界面,根据实际再点击页面
adb shell am start -n com.android.settings/.TetherSettings
相关推荐
秃头摸鱼侠6 小时前
MySQL安装与配置
数据库·mysql·adb
limingade17 小时前
ADB识别手机系统弹授权框-如何处理多重弹框叠加和重叠问题
adb·智能手机·android自动授权确认·安卓弹框授权·自动化点击android授权框
FREEDOM_X17 小时前
系统调试——ADB 工具
adb
超级小忍1 天前
如何配置 MySQL 允许远程连接
数据库·mysql·adb
betazhou2 天前
mariadb5.5.56在centos7.6环境安装
android·数据库·adb·mariadb·msyql
fengye2071613 天前
板凳-------Mysql cookbook学习 (十)
学习·mysql·adb
进击的CJR4 天前
MySQL 8.0 OCP 英文题库解析(十)
mysql·adb·开闭原则
VirusVIP4 天前
解决:如何在Windows adb使用dmesg | grep检查内核日志
linux·adb
睡觉待开机4 天前
4. 数据类型
android·adb
进击的CJR5 天前
MySQL 8.0 OCP 英文题库解析(十一)
mysql·adb·开闭原则