adb控制设备状态

屏幕设置

屏幕亮度

# 当前屏幕亮度
adb shell settings get system screen_brightness

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

屏幕休眠时间

# 当前屏幕休眠时间
adb shell settings get system screen_off_timeout

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

屏幕显示尺寸

# 查看当前屏幕尺寸
adb shell wm size
# 修改屏幕尺寸
adb shell wm size 400x500

蓝牙

获取蓝牙状态

# 1是开,0是关
adb shell settings get global bluetooth_on

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

设置蓝牙状态

# 开启蓝牙
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和热点

获取网络状态

# windows系统用findstr,linux系统用grep
adb shell ps | findstr wifi
# 有wpa_supplicant就表示wifi开启,有hostapd就表示热点开启
wifi            626      1   13992   3280 0                   0 S android.hardware.wifi@1.0-service
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状态

# 打开WiFi
adb shell svc wifi enable  

#关闭WiFi
adb shell svc wifi disable  

设置热点状态

# 进入热点界面,根据实际再点击页面
adb shell am start -n com.android.settings/.TetherSettings
  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值