public class

RecognizerIntent

extends Object
java.lang.Object
   ↳ android.speech.RecognizerIntent

Class Overview

Constants for supporting speech recognition through starting an Intent

Summary

Constants
String ACTION_RECOGNIZE_SPEECH Starts an activity that will prompt the user for speech and sends it through a speech recognizer.
String ACTION_WEB_SEARCH Starts an activity that will prompt the user for speech, sends it through a speech recognizer, and invokes and displays a web search result.
String EXTRA_LANGUAGE Optional language override to inform the recognizer that it should expect speech in a language different than the one set in the getDefault().
String EXTRA_LANGUAGE_MODEL Informs the recognizer which speech model to prefer when performing ACTION_RECOGNIZE_SPEECH.
String EXTRA_MAX_RESULTS Optional limit on the maximum number of results to return.
String EXTRA_PROMPT Optional text prompt to show to the user when asking them to speak.
String EXTRA_RESULTS An ArrayList of the potential results when performing ACTION_RECOGNIZE_SPEECH.
String EXTRA_RESULTS_PENDINGINTENT When the intent is ACTION_RECOGNIZE_SPEECH, the speech input activity will return results to you via the activity results mechanism.
String EXTRA_RESULTS_PENDINGINTENT_BUNDLE If you use EXTRA_RESULTS_PENDINGINTENT to supply a forwarding intent, you can also use this extra to supply additional extras for the final intent.
String LANGUAGE_MODEL_FREE_FORM Use a language model based on free-form speech recognition.
String LANGUAGE_MODEL_WEB_SEARCH Use a language model based on web search terms.
int RESULT_AUDIO_ERROR Result code returned when an audio error was encountered
int RESULT_CLIENT_ERROR Result code returned when there is a generic client error
int RESULT_NETWORK_ERROR Result code returned when a network error was encountered
int RESULT_NO_MATCH Result code returned when no matches are found for the given speech
int RESULT_SERVER_ERROR Result code returned when the recognition server returns an error
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_RECOGNIZE_SPEECH

Starts an activity that will prompt the user for speech and sends it through a speech recognizer. The results will be returned via activity results, or forwarded via a PendingIntent if one is provided.

Required extras:

Optional extras:

Result extras:

NOTE: There may not be any applications installed to handle this action, so you should make sure to catch ActivityNotFoundException.

Constant Value: "android.speech.action.RECOGNIZE_SPEECH"

public static final String ACTION_WEB_SEARCH

Starts an activity that will prompt the user for speech, sends it through a speech recognizer, and invokes and displays a web search result.

Required extras:

Optional extras:

Result extras:

NOTE: There may not be any applications installed to handle this action, so you should make sure to catch ActivityNotFoundException.

Constant Value: "android.speech.action.WEB_SEARCH"

public static final String EXTRA_LANGUAGE

Optional language override to inform the recognizer that it should expect speech in a language different than the one set in the getDefault().

Constant Value: "android.speech.extra.LANGUAGE"

public static final String EXTRA_LANGUAGE_MODEL

Informs the recognizer which speech model to prefer when performing ACTION_RECOGNIZE_SPEECH. The recognizer uses this information to fine tune the results. This extra is required. Activities implementing ACTION_RECOGNIZE_SPEECH may interpret the values as they see fit.

Constant Value: "android.speech.extra.LANGUAGE_MODEL"

public static final String EXTRA_MAX_RESULTS

Optional limit on the maximum number of results to return. If omitted the recognizer will choose how many results to return. Must be an integer.

Constant Value: "android.speech.extra.MAX_RESULTS"

public static final String EXTRA_PROMPT

Optional text prompt to show to the user when asking them to speak.

Constant Value: "android.speech.extra.PROMPT"

public static final String EXTRA_RESULTS

An ArrayList of the potential results when performing ACTION_RECOGNIZE_SPEECH. Only present when RESULT_OK is returned.

Constant Value: "android.speech.extra.RESULTS"

public static final String EXTRA_RESULTS_PENDINGINTENT

When the intent is ACTION_RECOGNIZE_SPEECH, the speech input activity will return results to you via the activity results mechanism. Alternatively, if you use this extra to supply a PendingIntent, the results will be added to its bundle and the PendingIntent will be sent to its target.

Constant Value: "android.speech.extra.RESULTS_PENDINGINTENT"

public static final String EXTRA_RESULTS_PENDINGINTENT_BUNDLE

If you use EXTRA_RESULTS_PENDINGINTENT to supply a forwarding intent, you can also use this extra to supply additional extras for the final intent. The search results will be added to this bundle, and the combined bundle will be sent to the target.

Constant Value: "android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE"

public static final String LANGUAGE_MODEL_FREE_FORM

Use a language model based on free-form speech recognition. This is a value to use for EXTRA_LANGUAGE_MODEL.

Constant Value: "free_form"

public static final String LANGUAGE_MODEL_WEB_SEARCH

Use a language model based on web search terms. This is a value to use for EXTRA_LANGUAGE_MODEL.

Constant Value: "web_search"

public static final int RESULT_AUDIO_ERROR

Result code returned when an audio error was encountered

Constant Value: 5 (0x00000005)

public static final int RESULT_CLIENT_ERROR

Result code returned when there is a generic client error

Constant Value: 2 (0x00000002)

public static final int RESULT_NETWORK_ERROR

Result code returned when a network error was encountered

Constant Value: 4 (0x00000004)

public static final int RESULT_NO_MATCH

Result code returned when no matches are found for the given speech

Constant Value: 1 (0x00000001)

public static final int RESULT_SERVER_ERROR

Result code returned when the recognition server returns an error

Constant Value: 3 (0x00000003)