val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
val enabledInputMethodList = imm.enabledInputMethodList
In the above snippet, I'm able to get the enabled Keyboards in my device. But I would like to know specifically which keyboard( Gboard or Microsoft SwiftKey) is sending the event
See this answer: https://stackoverflow.com/a/14371088/6591585
It tells you the default keyboard app. While it doesn't say which keyboard is being used to input the text, chances are it's the same as the default.