I am trying to check, if android default keyboard is open or not. I did not find anything to check keyboard using JAVA and ADB command in Appium.
I have found this ADB command to check keyboard is opened or not.
adb shell dumpsys input_method | grep mInputShown
In output mInputShown=true
if keyboard is open and mInputShown=false
if keyboard is closed.
JAVA code:
String cmd[] = new String[]{"adb", "shell", "dumpsys", "input_method", "|" ,"grep", "mInputShown"};
Process process = Runtime.getRuntime().exec(cmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String output = reader.readLine();