From cc47fae688e55edefd0abd15811d674ba47889e0 Mon Sep 17 00:00:00 2001 From: Alex Gruenstein Date: Tue, 9 Feb 2010 14:36:42 -0800 Subject: [PATCH] Add EXTRA_PARTIAL_RESULTS so that clients can enable receiving results via onPartialResults() --- api/current.xml | 13 ++++++++++++- core/java/android/speech/RecognitionListener.java | 3 ++- core/java/android/speech/RecognizerIntent.java | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/api/current.xml b/api/current.xml index a8f710946e742..31ab3cec4047c 100644 --- a/api/current.xml +++ b/api/current.xml @@ -135940,6 +135940,17 @@ visibility="public" > + + - + diff --git a/core/java/android/speech/RecognitionListener.java b/core/java/android/speech/RecognitionListener.java index 5434887006a17..2f5bcc3ddb53e 100644 --- a/core/java/android/speech/RecognitionListener.java +++ b/core/java/android/speech/RecognitionListener.java @@ -79,7 +79,8 @@ public interface RecognitionListener { * time between {@link #onBeginningOfSpeech()} and {@link #onResults(Bundle)} when partial * results are ready. This method may be called zero, one or multiple times for each call to * {@link RecognitionManager#startListening(Intent)}, depending on the speech recognition - * service implementation. + * service implementation. To request partial results, use + * {@link RecognizerIntent#EXTRA_PARTIAL_RESULTS} * * @param partialResults the returned results. To retrieve the results in * ArrayList<String> format use {@link Bundle#getStringArrayList(String)} with diff --git a/core/java/android/speech/RecognizerIntent.java b/core/java/android/speech/RecognizerIntent.java index 334b04909adaa..241a8b0d7d248 100644 --- a/core/java/android/speech/RecognizerIntent.java +++ b/core/java/android/speech/RecognizerIntent.java @@ -77,6 +77,7 @@ public class RecognizerIntent { *
  • {@link #EXTRA_PROMPT} *
  • {@link #EXTRA_LANGUAGE} *
  • {@link #EXTRA_MAX_RESULTS} + *
  • {@link #EXTRA_PARTIAL_RESULTS} * * *

    Result extras (returned in the result, not to be specified in the request): @@ -165,6 +166,13 @@ public class RecognizerIntent { */ public static final String EXTRA_MAX_RESULTS = "android.speech.extra.MAX_RESULTS"; + /** + * Optional boolean to indicate whether partial results should be returned by the recognizer + * as the user speaks (default is false). The server may ignore a request for partial + * results in some or all cases. + */ + public static final String EXTRA_PARTIAL_RESULTS = "android.speech.extra.PARTIAL_RESULTS"; + /** * When the intent is {@link #ACTION_RECOGNIZE_SPEECH}, the speech input activity will * return results to you via the activity results mechanism. Alternatively, if you use this