Implement keyboard wedge on Android

855 Views Asked by At

What is the best way to send global keyboard events to the currently active app on Android? Like a so-called keyboard wedge implementation - in this case barcode data that is received in another app (service) and should be sent to the active app as keyboard events.

I know that some USB or bluetooth scanners implement this, probably mostly by behaving as, and being recognized as, a keyboard. But I assume this can also be done from an Android Service?

Using Instrumentation should work, but requires a signed system app.

Implemting an InputMethod also works, but only when the caret is placed in a field (enabling input), and only when explicitly choosing this "keyboard"/input method.

What I need is general keyboard events to the currently open app - ultimately I need javascript keyboard events in a web browser (Chrome).

0

There are 0 best solutions below