Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android adb turn on wifi via adb [duplicate]

My phone has been locked (too many pattern attempts). To unlock I need to enter username and password on my gmail account. This is the only way I can unlock it. I cant launch any activities, even to turn on wifi connection. Without internet connection I can't sign in to restore my phone.

Maybe there is any command in adb to turn on my wifi connection, so I can use my phone?

like image 548
pleerock Avatar asked Apr 23 '12 14:04

pleerock


People also ask

What is adb over Wi-Fi?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.


2 Answers

This works really well for and is really simple

adb -s $PHONESERIAL shell "svc wifi enable"

like image 182
devin Avatar answered Oct 09 '22 21:10

devin


WiFi can be enabled by altering the settings.db like so:

adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db update secure set value=1 where name='wifi_on'; 

You may need to reboot after altering this to get it to actually turn WiFi on.

This solution comes from a blog post that remarks it works for Android 4.0. I don't know if the earlier versions are the same.

like image 39
D__ Avatar answered Oct 09 '22 20:10

D__