Wednesday, June 19, 2013

How to unlock android device with adb


Well you can easily unlock your device if your device is connected to internet by simply logging into your google account.
The following trick will help you unlock your device with ADB if your device is not connected to internet.
Too many attemps


 Pros:
The following trick has a greater advantage on hard reset. It preserves all your data unlike hard resetting.

Cons:
you've got have your debugging mode enabled.

The following trick is for windows and may work perfectly for other systems too.

Download android SDK (go to http://developer.android.com/sdk/index.html and download apllicable version) on PC
And extract file to C drive
Change the directory to "android" for the sake of simplycity

Now, Connect the device with USB cable to the PC
Install USB drivers for android device on PC (Update drivers)

Open the command prompt (cmd) in Windows

Change directory to the android SDK platform tools (cd C:\Android\android-sdk\platform-tools)
or hold shift button and right-click on platform-tools and open command-window here.

Type following commands in cmd

Now you have a command window with C:/android/sdk/platform-tools>
Connect your android device to PC with usb cable
Type following in cmd line:
adb devices ( hit enter)
 (verify device is identified by pc. If not reconnect device and try again. it should display “device” with a serial no)
adb shell (enter)
cd /data/data/com.android.providers.settings/databases( hit enter)
sqlite3
settings.db (hit enter)
update system set value=0 where name='
lock_pattern_autolock'; (hit enter)
 update secure set value=0 where name='
lock_pattern_autolock'; (hit enter)
update system set value=0 where name='lockscreen.lockedoutpermanently';(hit enter)
update secure set value=0 where name='
lockscreen.lockedoutpermanently';(hit enter)
.quit(hit enter)
exit(hit enter)
adb reboot (hit enter)
Congratulations! Your device is perfectly working. Isn’t it?
If not! your work has increased a little. do this step too in the cmd line type following:
adb shell (hit enter)
rm /data/system/gesture.key (hit enter if your screen is locked with gesture, replace gesture.key with password.key if your screen is locked with password.
reboot your device and congratulations

The above command will clear lock patterns and remove the permanent lock from the database.

How To Backup data 

Verify your phone is On, plugged into the back of the computer, and USB debugging is turned on
Copy sdcard contents to your computer, such as music, files and pictures
Open the “C:\android-sdk-windows\platform-tools” folder
Open a command prompt

Press and hold the shift key and right click in the folder window
Select Open Command Window Here

In the command prompt type “adb backup –apk –shared –all –f /backup/mybackup.ab” and press Enter

This will create a backup folder, and save the backup to “c:/backup/mybackup.ab”
It will backup your app data + the apks

On your phone you should see the screen on the right
Create a simple password

Make this easy to remember
You must not forget this password

Select Back up my data

This may take several minutes. When its complete a screen will say backup complete, and the phone with return to the homescreen

On the computer, go to the “C:\backup\” and verify there is a file labeled mybackup.ab
You have successfully backed up your phone

How To Restore

Verify your phone is On, plugged into the back of the computer, and USB debugging is turned on
Open the “C:\android-sdk-windows\platform-tools” folder
Open a command prompt

Press and hold the shift key and right click in the folder window
Select Open Command Window Here

In the command prompt type “adb restore C:\backup\mybackup.ab” and press Enter
When the phone shows the Full restore screen, type in the password you created in the Backup your phone with ADB section

This may take several minutes, be patient

You have now restored your phone

1 comment: