I tried to capture keypresses in a custom Android app (to compile statistics on which letters were typed most often, not keylogging) via the Android engine, and it seemed to be [reasonably] locked down for security reasons. I’d be curious to know if this is possible on any platform.
@YogiYang, I don’t think that’s a viable approach. However, you could take the keyman code as a basis – it’s open source so you can fork it and do what you want with it. Hooks are very tricky to get right – we have literally 30 years of experience embedded in the Keyman code. We won’t have the resources to help you navigate the code for this purpose, however.
@Matthew_Lee, every platform is completely different. It’s relatively easy on desktop platforms – albeit with many security and compatibility caveats. Android and iOS, no.
See the Keyman source for some ideas on how – for Windows, Linux, macOS.