Lock or unlock device using appium

Class AndroidDriver (implements AppiumDriver interface)  has certain methods for locking and unlocking an android device / emulator at run time. (should upgrade java-client.jar to version 4)


  • isLocked() – Check if device is locked

Returns true, if device is locked, else returns false

  • Unlock a device
  • Lock a device

NOTE: these methods doesn’t hold good if you have set pass code / pin code or patterns to unlock.

Open emulator or connect android mobile to computer, start Appium and run below code


Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *