6

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).

Dennis Thrysøe
  • 1,791
  • 4
  • 19
  • 31

0 Answers0