How to Unlock Pattern Locked Android Smartphone with ADB Commands?
Most probably everyone might face the situation of getting Android device locked or it’s just freezing quite a lot. There are many easy solutions right from removing its battery, manual resetting (click here) and using backup options such as sky drive and much more. 

But what if your device does not start itself? Or it is locked with multiple attempts? Or it may be for some other reason. Again if you have no Wi-Fi ON or your device is in airplane mode or not set to internet accessibility.

Android Smartphone LockedAndroid tips


The answer is using windows based commands to operate your Android device to resolve this issue.

Method: Using ADB (Android Debug Bridge) Commands

ADB is advanced command line tool which enables a user to communicate with Android device using commands on PC.

Requirements:

1. Windows PC

2. Device with USB cable

3. Android SDK developer toolkit (Click here to get from Android Developer Website)

4. Usb drivers for your device, or if your device is recognizing self then it’s not required
If this does not list your device then try to go on your device's company's website or Google your device with "device name android USB drivers for windows", (Click here to get from Developer Website)

5. Proper command follow-up

Unzip downloaded Android SDK files on your PC. Go to unzipped SDK folder and follow this path
"android-sdk_r07-windowsandroid-sdk-windowstools"

Just click an adb.exe file to install the program, it shows a small window and it disappears immediately. Don't worry, its done.

Click Start>Run>cmd. This will take you to dos-based windows command prompt window.
Type cd "android-sdk-windowstools"

You must be now in the ADB folder.

In the came command window type "adb devices"

If it shows the device then you are on a correct path. If not, you probably need your phone's driver set to install in the computer.

Now you must be ready to do work on your Android device, such as backup, flashing, resetting, hard resetting.

Above method is discussed considering your Android device is locked with multiple pattern password attempts. So we will move further to run few more commands to unlock it in easy ways.

In cmd type in following set of commands

adb devices (This will show your device)
adb shell
cd/data/data/com.android.providers.settings/databases
sqlite3 settings.db
update system set value=0 where name='lock_pattern_autolock';
update system set value=0 where name='lockscreen.lockedoutpermanently';
.quit

Now reboot your device. With this, your phone must be unlocked.

If above codes do not work then try below
adb shell rm/data/system/gesture.key

This will remove any pattern kept on your device and you will need to input new pattern.

Note: If you do not wish someone else to use ADB commands on your smartphone in any way then go to your smartphone's security options and select the option saying keep off USB debugging mode. But this is very risky as you do not need to worry so much about your smartphone as it is not a question of National Security.

If you like to add some more commands for easy navigation and recovery pl provide here for others help.

27 comments:

  1. Will this work for a pin password ?....i forgot my pin password not pattern

    ReplyDelete
  2. Thanks For Your valuable posting, it was very informative. i am working in Erp In India

    ReplyDelete
  3. always welcome.... lot more to come... keep bookmarked or subscribe for sure. I gurantee you it will be worth in touch

    ReplyDelete
  4. Nice
    what if usb debugging is off ?

    ReplyDelete
  5. Thanks For Your valuable posting, it was very informative. Am working in Erp Software Company In India

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. Thanks For Your valuable posting, it was very informative. Am working in Erp Software Company In India

    ReplyDelete
  8. I have successfully connected my android device with adb shell. But cannot
    $ rm /data/system/gesture.key
    I am getting rm: /data/system/gesture.key: Permission denied. Error
    My device is not rooted. Please help

    ReplyDelete
    Replies
    1. You'd definitely need root to do this. The explanation above, typos aside, is pretty lackluster. You can flash a custom recovery then flash SuperSU *IF* your screen is still working. If not it could be tricky. I didn't think there was a way to enable USB debugging with no screen but apparently there might be:
      Adb shell
      echo "persist.service.adb.enable=1" >>/system/build.prop
      echo "persist.service.debuggable=1" >>/system/build.prop
      echo "persist.sys.usb.config=mass_storage,adb" >>/system/build.prop"
      reboot

      Edit: Sorry I should have mentioned those commands would be done in a custom recovery like TWRP.

      Delete
    2. Apparently if you have a custom recovery and can get to a command prompt you can do the following to enable USB debugging:
      Adb shell
      echo "persist.service.adb.enable=1" >>/system/build.prop
      echo "persist.service.debuggable=1" >>/system/build.prop
      echo "persist.sys.usb.config=mass_storage,adb" >>/system/build.prop"
      reboot

      Delete
  9. Smartphone Security Encrypted, secured communication solutions for smartphones and telephony systems, including complete anti-tapping & anti-hacking solutions and apps; advanced SCADA cyber defense solutions

    ReplyDelete
  10. When you purchase a phone from your carrier, it usually comes locked to their service. If you want to use the phone you purchased through your carrier on another service, chances are you'll need to unlock mobile phone. This will allow you to use SIM cards from other carriers.

    ReplyDelete
  11. Replies
    1. If you have a custom recovery or can flash one (possible but tricky with no screen) the following commands supposedly enable it:

      Adb shell
      echo "persist.service.adb.enable=1" >>/system/build.prop
      echo "persist.service.debuggable=1" >>/system/build.prop
      echo "persist.sys.usb.config=mass_storage,adb" >>/system/build.prop"
      reboot

      Delete
  12. Does it work with usb debugging disabled?? My phone is locked, and i can't change anything. Want to save my photos or unlock it some how.please help. Im desperate. Just want my phoyos as my family are on thrre. Some whcih are not around anymore :(

    ReplyDelete
    Replies
    1. Step 1. After download Aroma File Manager place it in your memory card (SD card). Insert the memory card into your locked android device.

      Step 2. Open Stock Recovery Mode with reboot your android device and pressing Power Key and Volume up key simultaneously. Different phones may be have different methods to open stock recovery mode so if you face any problem Google it.

      Step 3. After entering into recovery mode use Volume+ and Volume- buttons to scroll up and down. For select use middle button.

      Step 4. From there click on “Install Zip from SD Card” and give path to install “Aroma File Manager” from SD card.

      Step 5. After installing, it will open in recovery mode.

      Step 6. From the Aroma File Manager navigate to settings >> go to bottom and click on “Automount all devices on start” and then exit.

      Step 7. Repeat Step 4 & 5 again.

      Step 8. After this you will get “Aroma File Manager” opened again.

      Step 9. Now navigate to Data Folder >> System Folder and find >> “gesture.key” or “password.key” for pattern lock or password lock respectively.

      Step 10. Delete that any one file and then exit aroma file manager and reboot your android device. After rebooting you will notice that password or pattern lock not removed. But don’t worry draw any pattern and you will open your android device but remember or note that pattern.

      Delete
  13. Does it work with usb debugging disabled?? My phone is locked, and i can't change anything. Want to save my photos or unlock it some how.please help. Im desperate. Just want my phoyos as my family are on thrre. Some whcih are not around anymore :(

    ReplyDelete
    Replies
    1. http://android.stackexchange.com/questions/112040/how-to-enable-usb-debugging-in-android-if-forgotten-pattern-for-screen-unlock

      Delete
    2. http://forum.xda-developers.com/showthread.php?t=2308130

      Delete
    3. http://forum.xda-developers.com/showthread.php?t=2786395

      Delete
  14. Does it work on unrooted phone

    ReplyDelete
  15. Here is another way to unlock pattern lock for Samsung Galaxy phones, and no data loss

    http://www.youtube.com/watch?v=lw4ueft-t_I

    ReplyDelete
  16. android is linux spawn
    a shitty os crafted by kids desperately fleeing off from windoze
    those f**ing linux turds always amaze me on their incompetencies

    ReplyDelete
  17. Are you aware that both iOS and Android are Linux based?
    Or that nearly every web server/data center runs on Linux? It's anything but a shitty OS, but you obviously have no real knowledge of OSs.

    ReplyDelete
  18. LMFAO! Justin, thank you my friend. You just took the words right from my mouth about this guy trying to say android is a crappy linux OS. HAHAHAHA He claims being amazed by their incompetence, LMAO who's the one with extreme incompetence now lol!!!!

    well anyways quick question and shot in the dark and I do apologize for my question as it doesn't pertain to this posting but would you happen to know an ADB Method that would help me retrieve my sim/network unlock code for my android device? I currently have a Moto E 2nd Gen model XT1526 that id like to get to work on verizons network. This is a great informative post by the way to the providers of this site.

    ReplyDelete
  19. Setup.exe blunders might be created by malignant programming programs, on the grounds that these projects can roll out improvements to your framework. Your framework may run moderate, show incessant mistake messages, crash, or need rebooting every now and again when these product projects are available on your PC.ABD Setup

    ReplyDelete

No more post found.