Search code examples
androidkeyboardroot

Android: Send Key Inputs to System / other Apps without Root


is it possible to send key inputs (events) to the system or other apps by an app without using root?

Background of my question:

I'm having an app that sends key inputs (text) to the system every some seconds. But my code requires root access and now a user asked, if it's possible to release my app without the need of root access.

This is my current code (requires a rooted device):

private void typeText(String sText) {
    CommandCapture command = new CommandCapture(0, "input text " + sText);
    try {
        RootTools.getShell(true).add(command).waitForFinish();
    } catch(Exception ex) {
    }
}

Just as info: I'm using the RootTools found on Google Code for Root Access.

Has anyone an idea how to send these key inputs without root access?

Thanks for any help or advice.


Solution

  • Due to the security on the android system it it not possible to do this without root access.