This question already has an answer here:
- How to turn off Wifi via ADB? 8 answers
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?
No need to edit any database directly, there is a command for it :)
svc wifi [enable|disable]
WiFi can be enabled by altering the settings.db like so:
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.
This works really well for and is really simple
adb -s $PHONESERIAL shell "svc wifi enable"
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/
I was in the same situation on a Samsung Mini II. I got around it eventually by holding down the power button until the "power off" menu appeared. From this menu it was possible to enable the network data connection.
Then signing in to my google account using @googlemail.com (rather than @gmail.com) seemed to do the trick. Though the change of address may just have given the phone time to warm up the 3g connection rather than making any real difference.
Try out the following which did work for me.
Method 1:
Tested on AT&T Fusion working fine.
Method 2:
Use the method given by shkschneider
This works only if you have USB debugging turned on. If you do not have USB debugging turned on under Development do the following.
Tested on AT&T fusion working fine.