0

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

Marcel Bro
  • 4,907
  • 4
  • 43
  • 70
rbd
  • 187
  • 2
  • 10
  • check here if it helps - http://stackoverflow.com/questions/7973023/what-is-the-list-of-supported-languages-locales-on-android – Tasos Feb 21 '16 at 10:31

1 Answers1

1

There is no way to do this. A keyboard doesn't report to Android the list of languages it supports.

In fact, most keyboards keep the input language separate from the phone's locale, in order to switch without resetting the UI of the entire phone. So the OS has no idea what languages a keyboard can write in or is currently writing in.

Marcel Bro
  • 4,907
  • 4
  • 43
  • 70
Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Hi, so whay do we have this API on Android? When i tested it on Nexus with it's original keyboard and different languages it reported back all available languages as expected – rbd Feb 21 '16 at 11:27
  • Google originally expected submethods to be used differently than they actually are. As of now, that api is pretty much useless – Gabe Sechan Feb 21 '16 at 11:29
  • Is there still no way to get installed keyboards? – user2924714 Sep 07 '16 at 08:52
  • Installed keyboards, our languages a keyboard supports? Two different questions – Gabe Sechan Sep 07 '16 at 13:17