0

How to turn on WIFI through adb on a motorola XYboard using android version 4.0

I have already tried the commands

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

but it just takes to the wifi settings, but the keyevent 20 is not taking to the "ON/OFF" button. In the new 4.0 version of android, we have to do a click on ON/OFF btton next to the WIFI to turn it on. How do I get to click that button using adb

Is there a command that will turn the wifi ON directly like the one for bluetooth, I can use

adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE

for turning bluetooth ON.

ronalchn
  • 12,225
  • 10
  • 51
  • 61
user1683289
  • 1
  • 1
  • 1
  • See this post: http://stackoverflow.com/questions/6461769/enable-disable-wifi-via-bash-scripting-on-android – Thommy Sep 19 '12 at 14:11
  • 1
    does this command work only if the unit is rooted?. I tried it and the reply was "svc wifi enable killed" and it didnot turn the wifi on!!.. – user1683289 Sep 19 '12 at 17:36

1 Answers1

0

Please check the keyevent codes for your phone, the keyevents 20 and 23 are for Droid X, the other droid X keyEvents are listed in this post : ADB Shell Input Events

So on your device the keycode events might be slightly different...

Community
  • 1
  • 1
Astric Star
  • 97
  • 1
  • 8