Security is good, especially for the smartphones that contain an enormous amount of information about you. One of those moments, however, when this security backfires, is when you get locked out of your phone. If the Wi-Fi is off, you are stuck. This happened to me recently, and I figured out a workaround.
I recently found my old phone and wanted to get some info off it. Turned out that I had a pattern lock on the device, and I did not remember what it was. The Wi-Fi was on, but the configuration was improper – the phone did not connect to Wi-Fi. After several tries, I was completely locked out, and any unlock attempts took me straight to the user account login screen. Fortunately, my phone was rooted, so there was a way out using ADB.
Get Access to Your Android Device After Being Locked Out
- A rooted device
- USB debug enabled
- ADB set up on your computer
If you are not familiar with ADB, we have previously written about everything that you may need to know about ADB (Android Debug Bridge). We have also mentioned a way to crack the pattern lock on an Android device. If that does not work, you might want to look at the approach below.
Steps to Enable and Set Up Wi-Fi
Note: The following steps were performed on a Mac terminal. Similar operations can be performed on a Windows machine from the command line.
Connect your Android device to your computer and open terminal.
The below command lists the Android devices connected to your PC, with the serial number.
Copy the serial number of the device that you want to unlock. Be sure to pick the right one in case the above command lists more than one device.
abd -s #PHONESERIAL shell svc wifi enable
Replace #PHONESERIAL with the serial number from the last step. Press enter. This command should enable the Wi-Fi on your device. Sometimes, you may need to restart the device for the Wi-Fi to be enabled.
The problem I was facing was that the Wi-Fi was enabled, but the network configuration was improper. As a result, even with WiFi on, the phone was not connecting to my home network. The way out of the problem is to pull the configuration file that saves the WiFi settings on your device, configure the credentials of the network that you want to connect to, and push the file back.
From the terminal, enter the below command.
abd pull /data/misc/wifi/wpa_supplicant.conf
The file would be pulled and saved into your current directory.
Open and edit the file contents with the credentials to your Wi-Fi network.
Update the SSID with your network name and PSK with password.
Set the priority as 1. Update the priority as 1. Save the file. Time to push the file back to the device with updated information.
adb push wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
This will prompt your Android device to attempt to connect to the Wi-Fi network that you set up. A restart may be required for the connection to establish.
Once done, you can go to the account unlock screen, enter the credentials of your Google account associated with the device and unlock it.
The above process was successfully tried on a rooted HTC Desire HD with custom ROM at Android version 4.0.3. If you try the above process and meet success / failure, do share with us in the comments below.