Aracılığıyla paylaş


SpeechRecognizer Class

Definition

This class provides access to the speech recognition service.

[Android.Runtime.Register("android/speech/SpeechRecognizer", DoNotGenerateAcw=true)]
public class SpeechRecognizer : Java.Lang.Object
[<Android.Runtime.Register("android/speech/SpeechRecognizer", DoNotGenerateAcw=true)>]
type SpeechRecognizer = class
    inherit Object
Inheritance
SpeechRecognizer
Attributes

Remarks

This class provides access to the speech recognition service. This service allows access to the speech recognizer. Do not instantiate this class directly, instead, call SpeechRecognizer#createSpeechRecognizer(Context), or SpeechRecognizer#createOnDeviceSpeechRecognizer(Context). This class's methods must be invoked only from the main application thread.

The implementation of this API is likely to stream audio to remote servers to perform speech recognition. As such this API is not intended to be used for continuous recognition, which would consume a significant amount of battery and bandwidth.

Please note that the application must have android.Manifest.permission#RECORD_AUDIO permission to use this class.

Java documentation for android.speech.SpeechRecognizer.

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.

Constructors

SpeechRecognizer(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ConfidenceScores

Key used to retrieve a float array from the Bundle passed to the RecognitionListener#onResults(Bundle) and RecognitionListener#onPartialResults(Bundle) methods.

DetectedLanguage

Key used to retrieve a String representation of the IETF language tag (as defined by BCP 47, e.

ErrorAudio
Obsolete.

Audio recording error.

ErrorCannotCheckSupport
Obsolete.

The service does not allow to check for support.

ErrorCannotListenToDownloadEvents
Obsolete.

The service does not support listening to model downloads events.

ErrorClient
Obsolete.

Other client side errors.

ErrorInsufficientPermissions
Obsolete.

Insufficient permissions

ErrorLanguageNotSupported
Obsolete.

Requested language is not available to be used with the current recognizer.

ErrorLanguageUnavailable
Obsolete.

Requested language is supported, but not available currently (e.

ErrorNetwork
Obsolete.

Other network related errors.

ErrorNetworkTimeout
Obsolete.

Network operation timed out.

ErrorNoMatch
Obsolete.

No recognition result matched.

ErrorRecognizerBusy
Obsolete.

RecognitionService busy.

ErrorServer
Obsolete.

Server sends error status.

ErrorServerDisconnected
Obsolete.

Server has been disconnected, e.

ErrorSpeechTimeout
Obsolete.

No speech input

ErrorTooManyRequests
Obsolete.

Too many requests from the same client.

LanguageDetectionConfidenceLevel

Key used to retrieve the level of confidence of the detected language of the most recent audio chunk, represented by an int value prefixed by LANGUAGE_DETECTION_CONFIDENCE_LEVEL_.

LanguageDetectionConfidenceLevelConfident
LanguageDetectionConfidenceLevelHighlyConfident
LanguageDetectionConfidenceLevelNotConfident
LanguageDetectionConfidenceLevelUnknown
LanguageSwitchResult

Key used to retrieve the result of the language switch of the most recent audio chunk, represented by an int value prefixed by LANGUAGE_SWITCH_.

LanguageSwitchResultFailed
Obsolete.

Switch attempted and failed.

LanguageSwitchResultNotAttempted
Obsolete.

Switch not attempted.

LanguageSwitchResultSkippedNoModel
Obsolete.

Switch skipped because the language model is missing or the language is not allowlisted for auto switch.

LanguageSwitchResultSucceeded
Obsolete.

Switch attempted and succeeded.

RecognitionParts

Key used to receive an ArrayList&lt;RecognitionPart&gt; object from the Bundle passed to the RecognitionListener#onResults(Bundle) and RecognitionListener#onSegmentResults(Bundle) methods.

ResultsAlternatives

Key used to retrieve an ArrayList&lt;AlternativeSpans&gt; from the Bundle passed to the RecognitionListener#onResults(Bundle) and RecognitionListener#onPartialResults(Bundle) methods.

ResultsRecognition

Key used to retrieve an ArrayList<String> from the Bundle passed to the RecognitionListener#onResults(Bundle) and RecognitionListener#onPartialResults(Bundle) methods.

TopLocaleAlternatives

Key used to retrieve an ArrayList&lt;String&gt; containing representations of the IETF language tags (as defined by BCP 47, e.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Cancel()

Cancels the speech recognition.

CheckRecognitionSupport(Intent, IExecutor, IRecognitionSupportCallback)

Checks whether recognizerIntent is supported by SpeechRecognizer#startListening(Intent).

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateOnDeviceSpeechRecognizer(Context)

Factory method to create a new SpeechRecognizer.

CreateSpeechRecognizer(Context, ComponentName)

Factory method to create a new SpeechRecognizer.

CreateSpeechRecognizer(Context)

Factory method to create a new SpeechRecognizer.

Destroy()

Destroys the SpeechRecognizer object.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsOnDeviceRecognitionAvailable(Context)

Checks whether an on-device speech recognition service is available on the system.

IsRecognitionAvailable(Context)

Checks whether a speech recognition service is available on the system.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRecognitionListener(IRecognitionListener)

Sets the listener that will receive all the callbacks.

StartListening(Intent)

Starts listening for speech.

StopListening()

Stops listening for speech.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
TriggerModelDownload(Intent, IExecutor, IModelDownloadListener)

Attempts to download the support for the given recognizerIntent.

TriggerModelDownload(Intent)

Attempts to download the support for the given recognizerIntent.

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Events

BeginningOfSpeech
BufferReceived
EndOfSegmentedSession
EndOfSpeech
Error
Event
LanguageDetection
PartialResults
ReadyForSpeech
Results
RmsChanged
SegmentResults

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to