How to unlock android phone through ADB
If you have to click OK after entering your passcode, this command will unlock your phone:
adb shell input text XXXX && adb shell input keyevent 66
Where
XXXX
is your passcode.66
is keycode of button OK.adb shell input text XXXX
will enter your passcode.adb shell input keyevent 66
will simulate click the OK button
Is there a way to unlock android phone via adb, if I KNOW the pattern
This is an old question but in the interest of helping anyone who finds this post, check out my android-pattern-unlock shell script.
It uses ADB's sendevent to draw a known unlock pattern into the lock screen. Worked for me and allowed me to gain access with a broken screen.
Activate/unlock phone via adb shell
Use adb shell input keyevent 26
to wake up the device. (Source) Now do the text input or whatsoever you want to do. And, unlocking can also be done using input
command but different locks requires different technique, so you'll have to Google a bit, or provide the info here so that I/others can answer it.
The same command can put the device to sleep as well.
Is there a way to check if Android device screen is locked via adb?
This command will output everything relating to power for the device:
adb shell dumpsys power
You can pipe this to a grep to get the values of mHoldingWakeLockSuspendBlocker
and mHoldingDisplaySuspendBlocker
:
adb shell dumpsys power | grep 'mHolding'
If both are false, the display is off.
If mHoldingWakeLockSuspendBlocker
is false, and mHoldingDisplaySuspendBlocker
is true, the display is on, but locked.
If both are true, the display is on.
Related Topics
Asking Camera Permission for Webview At Runtime
How to Clear Livedata Stored Value
How to Implement Referral Program in Mobile Apps for Both Android and Iphone
Fastest Way to Upload Multiple Image to Server in Android
How to Create a Folder in Android External Storage Directory
How to Turn Off Suggestions in Edittext
Error "Gradle Sync Failed: Connection Refused: Connect"
Android Sqlite: How to Retrieve Specific Data from Particular Column
How to Load New Values of Json After Every 10 Seconds
Not Opening Specific Activity on Notification Click When the App Is in Background/Not Running
Android Compress Video Before Upload to Server
How to Make a Background 20% Transparent on Android
Change Button Background At Runtime in Android
Load Video from Firebase Storage to Videoview
Image Scale Type Center Crop on Flutter
Android Fastboot Devices Not Returning Device