I use my android tablet with a wireless bluetooth keyboard. This keyboard ha开发者_Python百科s a few built in "hot keys" to launch specific programs. For example fn+f10 launches gmail. I am wanting to add some custom hotkeys. Does anyone have an idea of how the android os catches these keycodes from a bluetooth device? I know that this is probably something done on a system level, but I can't figure out were or how they are doing it. My device is rooted, so I should be able to make any necessary changes on the system level. Any thoughts on how I could accomplish this?
Basically you need to be able to intercept the bytes being sent through the bluetooth keyboard AND look at who is receiving these bytes. Knowing this will help you get started. And also follow what someoneHuman said! :)
I am fairly certain that the keyboard is actually just sending a KEYCODE_ENVELOPE KeyEvent (see this). So if you can make it so your app acts like a mail app that opens from the envelope KeyEvent then you should be good to go.
精彩评论