Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb shell input unicode character

Knowing the basic key mappings described in ADB Shell Input Events I get the emulation of text input and special keys working quite well. But what about Unicode characters? For instance I want to use umlauts from the German QWERTZ keyboard layout.

This gets me:

$ adb shell input text ö
Killed

So it seems to crash and

adb shell input text \xFC

prints xFC on the input. I have tried to the the events with getevent but I haven't found a direct mapping, I've also looked into the keymapping file /system/usr/keylayout/Qwerty.kl

I believe the only possibility is via the clipboard, but as pointed out in the question Pasting text into Android emulator clipboard using adb shell it seems to be unknown how to use it for Android Ice Cream Sandwich or later..

like image 248
Erandir Avatar asked Jan 08 '13 21:01

Erandir


People also ask

What does adb shell cat do?

Thus ADB shell commands let you control your Android device. Using ADB commands, you can reboot your device, push and pull files, create a backup and restore it, and sideload an update zip package, or an APK. ADB Shell commands, however, work on a much deeper level.


1 Answers

I wrote a virtual keyboard that accept broadcast intent, so you can send unicode characters to the editText view via adb.

for e.g. adb shell am broadcast -a ADB_INPUT_TEXT --es msg "你好嗎! Hello!"

Here is the github project: https://github.com/senzhk/ADBKeyBoard

Hope this little project would help.

like image 115
Eric Tang Avatar answered Sep 29 '22 05:09

Eric Tang