I'm trying to get the available input devices on Android, in order to do that I'm using the InputMethodManager
and using the API of getEnabledInputMethodList()
as follows:
InputMethodManager inputMgr = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> inputMethodList = inputMgr.getEnabledInputMethodList();
for (InputMethodInfo method : inputMethodList) {
List<InputMethodSubtype> subMethods = inputMgr.getEnabledInputMethodSubtypeList(method, true);
for (InputMethodSubtype submethod : subMethods) {
if (submethod.getMode().equals("keyboard")) { //Ignore voice input method
String localeString = submethod.getLocale();
Locale locale = new Locale(localeString);
String currentLanguage = locale.getLanguage();
//do something...
}
}
}
However, although I've got many more input languages available on my LG G3 and MEIZU M2, this API returns only 1 input language - English. It seems that this API works as expected only on Google Nexus phones.
Has anyone tried to do the same and succeeded?
P.S I've already read the solution on this thread but it doesn't help much: how to get user keyboard language