我正在通过adb自动化WiFi的开关。
根据测试用例,我想要禁用/启用WiFi。
到目前为止,我在这里发现了很好的信息。
但是,在执行以下命令之前,我想要测试连接。
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings adb shell input keyevent 19 & adb shell input keyevent 19 & adb shell input keyevent 23
以上命令可以禁用已启用的wifi,启用已禁用的wifi。我想先测试连接并在需要时采取行动。我想知道是否有一种使用adb命令来实现的方法。这可以通过编程实现,但我希望通过adb完成以使其更可靠。
此外,以下命令仅在设备已经root的情况下才有效。
adb shell "svc wifi enable"
以下命令可以在屏幕上启动测试,但不通过adb提供任何信息
adb shell am start -n com.android.settings/.wifi.WifiStatusTest