Good morning,
I would like to know if android devices are locked before creating my appium drivers.
I've browse the web to find a solution but I found nothing except that:
KeyguardManager myKM = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if( myKM.inKeyguardRestrictedInputMode()) {
//it is locked
} else {
//it is not locked
}
But I don't know how to retrieve/create the 'context' variable.
And I am not sure there is no other way (using adb command maybe) to know if a device is locked.
Configuration:
JAVA jdk 8 multi threading
Appium 1.6.0 and 1.6.4 BETA
OS: MAC
Android real devices
TestNG
Maven
Context:
1 - With adb, retrieve the number of connected device
2 - Start an Appium server per connected devices programmatically
3 - Create an Appium driver per connected devices
4- Start tests
Thanks a lot
Mag