1. Are you ready for the Galaxy S20? Here is everything we know so far!

Speech to text for RecognizerIntent

Discussion in 'Android Development' started by raghuk996, Oct 4, 2019.

  1. raghuk996

    raghuk996 Lurker
    Thread Starter

    Hi there,
    I am using google voice-to-text ,when i click on microphone and speak and stop for 1 second it is automatically closing.I have tried using the below code,but it is only silencing before starting anyone speaking,but i also what the microphone to listen after speaking for some seconds.can anyone please help me.

    source code:
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,300000);
    intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS,300000); intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS,300000); // Start the activity, the intent will be populated with the speech text intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"in.concent.healphaTest"); startActivityForResult(intent, SPEECH_REQUEST_CODE);
     


Loading...

Share This Page

Loading...