Connecting to WiFi using adb shell

前端 未结 6 761
Happy的楠姐
Happy的楠姐 2020-11-27 04:45

I have all the details to connect to a particular access point. I have to use that access point only, so all I require is the command to do it.

6条回答
  •  旧巷少年郎
    2020-11-27 05:00

    Late to the party, but I came up with a way to accomplish this on a device without root.

    It may not be pretty, but it works.

    Basically what I propose is to create an app that joins an access point based on EXTRAS given when starting the app. The EXTRAS are then provided using the am command's -e parameter.

    I already build an app which does so and it's available here: https://github.com/steinwurf/adb-join-wifi

    Once the app is installed, a wifi access point can be joined using the following ADB command:

    adb shell am start -n com.steinwurf.adbjoinwifi/com.steinwurf.adbjoinwifi.MainActivity -e ssid [SSID] -e password_type [PASSWORD_TYPE] -e password [WIFI PASSWORD]
    

    There's more info in the README on Github.

    Hope it helps someone.

提交回复
热议问题