How can I turn ON/OFF WiFi of android device from back end of the running application using adb shell??? Can I control the device WiFi signal strength using adb shell or any other technique??
Asked
Active
Viewed 2,244 times
1 Answers
0
You can not control the strength of Wifi using adb shell but you can turn On/off the wi-fi through adb shell and programatically also like :
- programatically:
but have to specify permissions :
<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
And Call it like
final WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(!wifi.isWifiEnabled());
2 . Through adb This is a little sketchy however, you can use "keyevents":
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
Using "adb shell", you can intent the android settings package and run the "wifi.WifiSettings" activity. From here we must then implement the key presses.
Also, if you need to know more about "keyevents":
adb shell input events Please let me know if this helps!

Community
- 1
- 1

Shridutt Kothari
- 7,326
- 3
- 41
- 61