I want to know the default keyboard chosen by the user in Android. I know I can access the list of enabled input methods using the InputMethodManager
, but I want to know which one is the user currently using.
So far, I've tried to get the current input method subtype:
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
InputMethodSubtype subtype =imeManager.getCurrentInputMethodSubtype();
But this object only seems to give me the Locale the user has picked and the input type (voice, keyboard,..).
I've also tried through the list of enabled input methods:
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
List<InputMethodInfo> list =imeManager.getEnabledInputMethodList();
for(InputMethodInfo i: list){
...
}
However the class InputMethodInfo
does not contain information of whether this method is the default input method or not.
I know there must be a way, because everytime I open SwiftKey Keyboard and is not set as the default keyboard a input method picker appears. So, how do they know their keyboard is not currently set as default?
I'm aware this question might be a duplicate, since it's the same as this one. However that question didn't get an answer, so I'm really hoping someone can help me now.
Thank you.
Use this to get default keyboard.
Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
To get more information about current keyboard:
for(InputMethodInfo i: list){
if (i.getId().equals(Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD))) {
...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With