Inject Keystrokes
-
25-09-2019 - |
Question
Is there a way to inject keystrokes into the JVM on the Android platform?
I'm looking for something like java.awt.Robot but I don't think that's available on Android
thanks
Solution 3
Well I'm actually working on a Synergy port to the android (synergy-foss.org) and I think the best (and only method) for faking out keystrokes on the device itself is to write to /dev/input/uinput. However it seems this is only available with Cyanogen mod
OTHER TIPS
It sounds like you need InstrumentationTestCase.sendKeys()
http://developer.android.com/reference/android/view/KeyEvent.html
You can use:
$ adb -s <serialno> emu event send <event>
where the event description can be something like:
"EV_KEY:KEY_A:1"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow