SpeechRecognizer.CreateSpeechRecognizer Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateSpeechRecognizer(Context) |
Factory method to create a new |
CreateSpeechRecognizer(Context, ComponentName) |
Factory method to create a new |
CreateSpeechRecognizer(Context)
Factory method to create a new SpeechRecognizer
.
[Android.Runtime.Register("createSpeechRecognizer", "(Landroid/content/Context;)Landroid/speech/SpeechRecognizer;", "")]
public static Android.Speech.SpeechRecognizer? CreateSpeechRecognizer (Android.Content.Context? context);
[<Android.Runtime.Register("createSpeechRecognizer", "(Landroid/content/Context;)Landroid/speech/SpeechRecognizer;", "")>]
static member CreateSpeechRecognizer : Android.Content.Context -> Android.Speech.SpeechRecognizer
Parameters
- context
- Context
in which to create SpeechRecognizer
Returns
a new SpeechRecognizer
- Attributes
Remarks
Factory method to create a new SpeechRecognizer
. Please note that #setRecognitionListener(RecognitionListener)
should be called before dispatching any command to the created SpeechRecognizer
, otherwise no notifications will be received.
For apps targeting Android 11 (API level 30) interaction with a speech recognition service requires <queries> element to be added to the manifest file:
{@code
<queries>
<intent>
<action
android:name="android.speech.RecognitionService" />
</intent>
</queries>
}
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSpeechRecognizer(Context, ComponentName)
Factory method to create a new SpeechRecognizer
.
[Android.Runtime.Register("createSpeechRecognizer", "(Landroid/content/Context;Landroid/content/ComponentName;)Landroid/speech/SpeechRecognizer;", "")]
public static Android.Speech.SpeechRecognizer? CreateSpeechRecognizer (Android.Content.Context? context, Android.Content.ComponentName? serviceComponent);
[<Android.Runtime.Register("createSpeechRecognizer", "(Landroid/content/Context;Landroid/content/ComponentName;)Landroid/speech/SpeechRecognizer;", "")>]
static member CreateSpeechRecognizer : Android.Content.Context * Android.Content.ComponentName -> Android.Speech.SpeechRecognizer
Parameters
- context
- Context
in which to create SpeechRecognizer
- serviceComponent
- ComponentName
the ComponentName
of a specific service to direct this
SpeechRecognizer
to
Returns
a new SpeechRecognizer
- Attributes
Remarks
Factory method to create a new SpeechRecognizer
. Please note that #setRecognitionListener(RecognitionListener)
should be called before dispatching any command to the created SpeechRecognizer
, otherwise no notifications will be received. Use this version of the method to specify a specific service to direct this SpeechRecognizer
to.
<strong>Important</strong>: before calling this method, please check via android.content.pm.PackageManager#queryIntentServices(Intent, int)
that serviceComponent
actually exists and provides RecognitionService#SERVICE_INTERFACE
. Normally you would not use this; call #createSpeechRecognizer(Context)
to use the system default recognition service instead or #createOnDeviceSpeechRecognizer(Context)
to use on-device recognition.
For apps targeting Android 11 (API level 30) interaction with a speech recognition service requires <queries> element to be added to the manifest file:
{@code
<queries>
<intent>
<action
android:name="android.speech.RecognitionService" />
</intent>
</queries>
}
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.