I need a way to press a key on an Android Keyboard ( irrespective of its language). For example, if the keyboard is in English and I press the "q" key it should type "q" but when the keyboard is in French it should show "a" (Because Keyboard is "QUERTY" and French is "AZERTY".
I have been through the google android docs here, which state that this should be possible: https://source.android.com/devices/input/keyboard-devices#notes
The Android key code associated with common alphanumeric and symbolic keys may vary based on the keyboard layout and language. For historical reasons, the physical scan codes and HID usages associated with keys on a keyboard are often defined positionally even though the labels printed on those keys may vary from one language to another.
On a US English (QWERTY) keyboard, the top-left alphabetic key is labeled Q. On a French (AZERTY) keyboard, the key in the same position is labeled A. Despite the label, on both keyboards the top-left alphabetic key is referred to using the HID usage 0x07 0x0014 which is mapped to the Linux key code KEY_Q.
When Android is configured with a US English keyboard layout, then the Linux key code KEY_Q will be mapped to the Android key code KEYCODE_Q and will produce the characters 'Q' and 'q'. However, when Android is configured with a French keyboard layout, then the Linux key code KEY_Q will be mapped to the Android key code KEYCODE_A and will produce the characters 'A' and 'a'.
The Android key code typically reflects the language-specific interpretation of the key, so a different Android key code may be used for different languages.
I have tried using ADB sendEvent function as well using the following command:
adb shell su 0 sendevent /dev/input/event12 1 30 1. // type a
adb shell su 0 sendevent /dev/input/event12 0 0 0. // press key
adb shell su 0 sendevent /dev/input/event12 1 30 0. // clear buffer
adb shell su 0 sendevent /dev/input/event12 0 0 0 // release key
But this too types "a" in both English and French Keyboard.
Is there a function/tool I can use to accomplish my task?
adb input text ..
oradb input keyevent ..
instead ? stackoverflow.com/a/8483797/150978