I am developing an app that needs to retrieve the list of languages that are available in the device, in order to gather statistics. Basically, I would like to retrieve the list of languages that the user can see (and select) when accessing the Language and input->Language setting of the Settings app. I've tried several ways but don't seem to work:
This retrieves a list of locales, but some of them are not available in the device:
Locale[] locales = Locale.getAvailableLocales();
This works fine in my physical device but in the emulator does not retrieve some of the languages that are available:
String[] locales = Resources.getSystem().getAssets().getLocales();
This obtains the list of languages the user has chosen in the Settings app (API >= 24):
LocaleList locales = getResources().getConfiguration().getLocales();
Is there any way in which I could retrieve such list?