How to turn off Wifi via ADB?

前端 未结 13 2199
北荒
北荒 2020-11-29 17:37

Im automating a testing procedure for wifi calling and I was wondering is there a way to turn off/on wifi via adb?

I would either like to disable/enable wifi or kill

13条回答
  •  粉色の甜心
    2020-11-29 18:12

    This works as of android 7.1.1, non-rooted

    adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings && adb shell input keyevent 23 && adb shell input keyevent 23
    

    This will launch the activity and then send the DPAD center keyevent. I added another DPAD center as an experiment to see if you can enable it in the same way.

提交回复
热议问题