speech: Update createSpeechRecognizer javadoc

SpeechRecognizer#createSpeechRecognizer(Context, ComponentName) should
be called only with ComponentNames that are actually mapped in the
running environment.

This update documents how to check the ComponentName is acutally mapped
to RecognitionService.

Bug: 187176179
Test: n/a javadoc change only
Change-Id: Icbf1595f613d6f341b84879122e5eefce6c0fb4a
This commit is contained in:
Andrea Ambu
2021-05-24 15:07:13 +01:00
parent 00630da0cf
commit df709e0d1b

View File

@@ -309,11 +309,16 @@ public class SpeechRecognizer {
* {@link #setRecognitionListener(RecognitionListener)} should be called before dispatching any
* command to the created {@code SpeechRecognizer}, otherwise no notifications will be
* received.
*
* Use this version of the method to specify a specific service to direct this
* {@link SpeechRecognizer} to. Normally you would not use this; use
* {@link #createSpeechRecognizer(Context)} instead to use the system default recognition
* service.
* {@link SpeechRecognizer} to.
*
* <p><strong>Important</strong>: before calling this method, please check via
* {@link android.content.pm.PackageManager#queryIntentServices(Intent, int)} that {@code
* serviceComponent} actually exists and provides
* {@link RecognitionService#SERVICE_INTERFACE}. Normally you would not use this; call
* {@link #createSpeechRecognizer(Context)} to use the system default recognition
* service instead or {@link #createOnDeviceSpeechRecognizer(Context)} to use on-device
* recognition.</p>
*
* <p>For apps targeting Android 11 (API level 30) interaction with a speech recognition
* service requires <queries> element to be added to the manifest file: