This blog post explains how to unlock an Android phone using adb if you know the password. This can be useful if the touch screen of your phone is broken.
If you don't know the password, try any of the 9 methods in the article http://joyofandroid.com/how-to-unlock-android-phone/ instead.
Prerequisites:
- You have a computer running Windows, Mac OS X or Linux.
- You have a USB cable with which you can connect the phone to the computer.
- USB debugging has been enabled on the phone. You can enable it in the Settings / Development menu (but you need a working touch screen for that).
- Install the adb command-line tool. It's part of the Platform SDK Tools SDK package. First download the Android SDK, then run the tools/android GUI tool, select Platform SDK Tools and install. The adb binary will be downloaded to platform-tools/adb .
- On Linux, follow these steps to make sure that your user has the permission to access the phone.
- Don't connect your phone yet to the computer via USB.
- Run adb devices and verify that it doesn't see the phone.
- If not enabled yet, enable USB debugging on the phone, in the Settings / Development menu.
- Connect the phone to your computer using an USB cable.
- Run adb devices and verify that it sees your phone.
- You will have to run the following two commands very quickly, i.e. faster than the screen blanking time on the phone.
- Run adb shell input text PASSWORD, replacing PASSWORD with your Android unlock password.
- Run adb shell input keyevent 66 to simulate pressing the Enter key. (See this page for event codes of other keys.)
you are my hero! my screen broke, so i can't input the screen lock PIN. i've been trying to figure out how to backup the data on it for hours. this worked perfectly!
ReplyDeleteI'm trying to do this on my mac (because my droid's screen is all cracked and I want my pictures) but I don't really understand how to go about this. Do I need eclipse to run this? All the files come up as Unix files and I'm not sure how to go about this. Thanks!
ReplyDelete@Sam: The steps described in the blog post don't need Eclipse. If the blog post is not easy for you to follow, please ask a computer geek friend to do it for you. Maybe this will help: in step 4, you have to open a Terminal window, and type the command there.
ReplyDeleteThis almost worked for me (faulty touchscreen) except I couldn't get adb to recognise the device because it was locked, and I couldn't unlock it because the touchscreen didn't work. I ended up connecting a keyboard with a USB OTG adapter and typing the PIN code in and pressing Enter to unlock it. The USB keyboard wasn't recognised the first time though, so you may need to reboot your device for this method to work!
ReplyDeleteYou sir saved my life! Thank you so much! If there is anything I can do to thank you let me know... I would even donate to a paypal!
ReplyDeleteWhat do you do if your password is a pattern?
ReplyDelete@Ravi Chandarana: The solution proposed here doesn't work in that case. I don't know how to solve that.
ReplyDelete