How to Turn Off Wifi via Adb

How to turn off Wifi via ADB?

Using "svc" through ADB (rooted required):

Enable:

adb shell su -c 'svc wifi enable'

Disable:

adb shell su -c 'svc wifi disable'

Using Key Events through ADB:

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

The first line launch "wifi.WifiSettings" activity which open the WiFi Settings page. The second line simulate key presses.

I tested those two lines on a Droid X. But Key Events above probably need to edit in other devices because of different Settings layout.

More info about "keyevents" here.

android adb turn on wifi via adb

Unfortunately the only way I could resolve my problem is to root the device.

Here is a good tutorial for Nexus S:

http://nexusshacks.com/nexus-s-root/how-to-root-nexus-s-or-nexus-s-4g-on-ics-or-gingerbread/

Turning off ADB over WiFi through ADB shell?

adbd is the adb daemon that runs on your devices, awaiting connection.

issuing stop adbd should kill it - you may have to run this as root, should stop adb on the device, and disconnect your active shell.

edit

just tried this and it worked for me, running cyanogenmod. using adb connect <ip>, and entering an adb shell, su for super user privileges, and then issue stop adbd. your shell should terminate, and you will not be able to reconnect until you restart it from your device. (shell or settings menu)

Disable wireless Android(ADB) debugging without root

To disable, run the command adb usb

adb usb : Restart the adb server listening on USB.

This is listed on the official android site

Disable ADB over wifi but leave connection over USB functioning

Khadas Vim3 have info about adb tcp port stored in file /vendor/build.prop.

To edit this file first remount /vendor directory writable.
mount -o rw,remount /vendor

Then edit build.prop file vi /vendor/build.prop and change value for option
service.adb.tcp.port to -1. Former value is 5555

New value: service.adb.tcp.port=-1

Then remount /vendor as read only mount -o ro,remount /vendor

And reboot device.

After that adb no longer connects to device through wifi but can connect through usb.



Related Topics



Leave a reply



Submit