'Is there a way of knowing which bluetooth keyboard sent a key event in Android?
Brief description
I have two wireless keyboards connected to the same Android device through Bluetooth LE. Is there any way of knowing which device sent a key event?
Use case
I can call specific Bluetooth methods on each individual keyboard. By pressing any key on each keyboard, I would like to be able to mark it as the currently active device and show it to the user by marking it in green.
What I've tried
I am able to read the KeyEvent through onKeyDown override. Through this, I can use getDevice() and obtain the InputDevice object. But I can't link this to the BluetoothDevice that originated the event. I also tried to use getevent and although it works on the adb shell, I don't have permissions to use this on the app since I must assume the Android device will not be rooted. I have also tried getting the BluetoothHIDDevice through the profile proxy, but I can't get the HID report information.
Is there any way of distinguishing between the two Bluetooth Keyboards on Android?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
