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?
This works really well for and is really simple
adb -s $PHONESERIAL shell "svc wifi enable"
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.
You can turn on wifi :
– connect usb on pc;
– will show alert dialog “connect UMS mode or KIES” – do not click, do not cancel
– pull notification bar and turn on wifi.
Try out the following which did work for me.
- Turn on the device
- Plug in the USB cable
- You will get the screen for turn on USB storage.
- Pull down the notification drawer
- Turn on wifi/Data
Tested on AT&T Fusion working fine.
Use the method given by shkschneider
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
This works only if you have USB debugging turned on. If you do not have USB debugging turned on under Development do the following.
- Turn off the device.
- Boot into recovery mode (Power button + Volume up)
- Plug the device into computer.
- Use the ADB tool to execute the same commands given by shkschneider
Tested on AT&T fusion working fine.
See these answers:
However, I’m pretty sure that Google actually stores your email and password (at the time of saving to the device) for times like these. So when it needs to be unlocked, it won’t require an internet connection.
I could be wrong. Either way, when I had this issue, I had internet connectivity, and I knew my username and password and it didn’t care, kept saying they were wrong (even though I was logging into my email). Had to format the phone at the time!
In my ROM, it’s stored in the “global” database, rather than “secure”. So D__’s answer is correct, but the sql line needs to connect to a different database:
sqlite3 /data/data/com.android.providers.settings/databases/settings.db update global set value=1 where name='wifi_on';
You should start the WiFi activity from
adb then simulate inputs:
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
Here is the list of
adb inputs: #7789826
I’m not sure if those keyevents are the right one for your case, but I think it will do.
It simulated a “down” to select the first checkbox, then an “enter”.
It’s so easy, man. Just press on the power button until you see the “Phone Options” screen and turn on mobile data. After that you can sign into your account or remotely unlock your device.
Unfortunately the only way I could resolve my problem is to root the device.
Here is a good tutorial for Nexus S:
I was having the same problem. my phone was locked and the wi-fi was off, but I signed into my gmail account and it was unlocked.
Hope this helps someone 🙂
If you are locked out and WiFi is turned off in your Androud device then one solution is to connect your phone to a PC (connected to internet) and try to login with your google account. – it worked for me.
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.
Not sure if this rather simple solution is already posted here somewhere.
The problem is locked phone w/o wifi connection, not rooted and USB
debugging disable (hell, worse possible situation). ADB can not be used since
“Adb devices” do not detect device with USB debugging disabled.
Tried recovery mode (can not enter it). Tried emergency mode (Adb still don’t
When I almost gave up and was like an inch from hard reset something strange happens. When I connect a phone to USB as usual USB entry screen appeared. Nothing new. What I noticed then is that in this screen it is actually possible to lower a drop down bar and bingo….I was able to turn wifi ON.
And then just entered google account and phone was unlocked.
Hope I helped someone.
No need to edit any database directly, there is a command for it 🙂
svc wifi [enable|disable]