What to Do If You Forget Android’s PIN Code or Pattern

We block the screen with a PIN and patterns so that no intruder can check out our cell phone, but… what happens when we forget the code? It’s like locking yourself out of your house. To go back in, you need to resort to special measures.

What to Do If You Forget Android's PIN Code or Pattern

Screen lockers require you to memorize some type of code, whether it’s a number, a password or a pattern. If you forget the code, accessing the phone becomes impossible.

There are ways to recover access to your phone or tablet if you forget the unlocking code. The method differs depending on the Android version.

If you use Android 4 or previous versions

After a few failed attempts at unlocking, Android forces you to wait 30 seconds before retrying. If you use Android 4 or previous versions, after several rounds of attempts you’ll see a “Forgotten PIN” or “Forgotten pattern” button: press it and introduce your Google details to unlock Android (you need an Internet connection for that).

Recuperacion del codigo

If you use Android 5 or 6

In Android 5, 6 and above, the “Forgotten PIN” or “Forgotten pattern” button does not show up. The method recommended by Google is to perform a remote reset of the phone through Android Device Manager. In this article, we will explain to you how this works. The drawback is that it wipes out all the data on your phone (except on your SD card).


Is it possible to unlock the device without resetting?

If you had USB Debugging enabled on your phone (in Settings > Developer), you can connect your phone or tablet by cable via the ADB (Android Debug Bridge) command, a free tool distributed with the Android SDK. Also, some recovery images for Android (Recovery), have USB debugging enabled by default.

Android SDK

Once the Android SDK is installed, connect your device to your PC with a good quality USB cable and open a command line. Go to the folder where you installed the SDK and execute the adb devices command. If ADB manages to connect to your device, you will then see a number on the table that is shown. In this case, rejoice, because you’re very close to the solution!


Everything ready? You need to introduce these commands:

adb shell
rm /data/system/locksettings.db
rm /data/system/locksettings.db-wal
rm /data/system/locksettings.db-shm

Once you have reset your phone or tablet, you will notice that Android is no longer requesting a code. The drawback of this method, as I mentioned above, is that it doesn’t work on devices that don’t have USB Debugging enabled. If that is the case, your only solution will be is to completely wipe out your data.

To avoid this inconvenience in the future, we recommend that you use a screen blocker with a password recovery option. We will soon be adding this characteristic to Screen Lock Guardian, so stay in tune…