i need to write a java code to execute some command for automation purpose. what i want to achieve is pushing image to camera.
i tried to write a code to input text via adb and it works.. it looks like this
public void inputTextByCode(String deviceId, String input) throws IOException{
welcomeTheTester();
String commandStr = "input keyboard text ";
Process process = null;
String commandString = "";
if(deviceId != null) {
commandString = String.format("%s", "adb -s " + deviceId + " shell " + commandStr + input);
} else {
commandString = String.format("%s", "adb shell " + commandStr + input);
}
System.out.print("Command is "+commandString+"\n");
try {
process = ProcessHelper.runTimeExec(commandString);
} catch (IOException e) {
}
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.print(line+"\n");
}
}
it will produce adb command as
adb -s 192.168.28.101:5555 shell input keyboard text testing
could i do the same,, but with camera? how could i push image / some kind of stream to android camera?