I've developed an Android app that connects to a PC over Bluetooth Low Energy and enables control of the keyboard from the Android device. This app sends physical HID keycodes to the PC instead of text. It's written in Jetpack Compose.
According to the research I've conducted, there doesn't seem to be a straightforward method to retrieve keycodes from key presses on the on-screen keyboard in Android. So, I'm turning to Stack Overflow for help.
Is there a way to obtain the exact keycode when a user presses a key on the on-screen keyboard, regardless of the keyboard layout? If not, is there a way to detect key presses through text changes, and how can I do this across different layouts?
Thank you for any assistance you can provide.
On screen keyboards don't use keycodes, or keypresses. They mostly use the commitText API on InputConnection. KeyPresses are for physical keys, such as a hardware USB keyboard."
So no, there isn't, because that's not a concept they use.