I'm trying to input text into the current running application (not my own) using the adb input text method, this works if I run it from the command prompt such as 'adb input text "Android" and also if I run it from terminal emulator. However the below code run successfully but produces no output on the screen.. I have also tried various other methods to run shell commands which have also not failed but not output any text.. Anyone know what I am doing wrong?
try {
//Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("input text \":\"");
} catch (IOException e) {
e.printStackTrace();
}
To inject text into an android app the injector must have
android.permission.INJECT_EVENTS
permission, so it must be a system app.
Your Runtime.getRuntime().exec has not this permission.