Question

i want to know how to get the status of android phone screen whether its locked or unlocked using monkeyrunner . please help .

Thanks in advance

Was it helpful?

Solution

Using AndroidViewClient (>= 4.7.0) (which uses python instead of monkeyrunner`) you can do

from com.dtmilano.android.viewclient import ViewClient

device, serialno = ViewClient.connectToDeviceOrExit()
if device.isLocked():
    device.wake()
    device.unlock()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top