1

Before android 13 I can successfully get supported languages through broadcast receiver using intent RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS. On android 13 extras are empty. Code follows:

public class LanguageDetailsChecker extends BroadcastReceiver {
        // for API < 13;
        @Override
        public void onReceive(Context context, Intent intent)  {
            Bundle results = getResultExtras(true);
            if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))  {
                //languagePreference = results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
            }
            if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
                //supportedLanguages =  results.getStringArrayList( RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
            }
        }
    }

Surely I see new API for Android 13:

speechRecognizer.checkRecognitionSupport(testIntent, Executors.newSingleThreadExecutor(), new RecognitionSupportCallback() {
                    @Override
                    public void onSupportResult(@NonNull RecognitionSupport recognitionSupport) {}
                    @Override
                    public void onError(int error) {
                        Log.e(LOG_TAG, " onError >>>>>>>>>>>> ?? " + error);
                    }
                });

which always drops me into onError with code 14.

BTW the same API works perfectly for Samsung speech recognizer (AiAiSpeechRecognitionService) which I am testing along with the Google service.

I have read this which states that SpeechService was removed, but at the meantime they have introduced app to replace the service and furthermore, they have introduced new API (checkRecognitionSupport) which seems to produce error constantly.

And I have read this which does not give me a hint of how to make work new API.

Would appreciate any help.

0 Answers0