I need to display an alert to the user if they haven't enabled Google voice typing from their settings(Language and input -> Google voice typing). Is there someway to detect that setting status?
Asked
Active
Viewed 938 times
2 Answers
1
So i found my answer. There is no official way of detecting wether voice typing is enabled or not. I have managed to get a list of enabled input methods ( keyboard, voice, etc).
String enabledMethods = Settings.Secure.getString(getActivity().getContentResolver(),Settings.Secure.ENABLED_INPUT_METHODS);
There we can see if Google voice typing is enabled or not and we can alert the user to turn it on, however this applies for the default keyboard. Some users use custom keyboards that have their own implementation of speech to text and it doesn't relly on the users settings for Google voice typing. So it will be a false positive for them.

Krasimir Unarev
- 39
- 3
-
this command by Krasimir returns com.sec.android.inputmethod/.SamsungKeypad:com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService. You can check if string contains %voice%... – Al2x Apr 14 '17 at 20:00
0
Given that you know the package name of the IME, you can do something like this:
boolean isImeEnabled(String packageName) {
InputMethodManager imm =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
for (InputMethodInfo imi : imm.getEnabledInputMethodList()) {
if (imi.getPackageName().equals(packageName)) {
return true;
}
}
return false;
}

Kaarel
- 10,554
- 4
- 56
- 78