android adb turn on wifi via adb [duplicate]

2019-01-21 06:10发布

This question already has an answer here:

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?

14条回答
爷、活的狠高调
2楼-- · 2019-01-21 06:40

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.

查看更多
唯我独甜
3楼-- · 2019-01-21 06:43

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';
查看更多
孤傲高冷的网名
4楼-- · 2019-01-21 06:43

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.

查看更多
Explosion°爆炸
5楼-- · 2019-01-21 06:43

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 :)

查看更多
可以哭但决不认输i
6楼-- · 2019-01-21 06:51

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".

查看更多
Ridiculous、
7楼-- · 2019-01-21 06:51

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 detect device). 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.

查看更多
登录 后发表回答