RecognitionService


public abstract class RecognitionService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.speech.RecognitionService


This class provides a base class for recognition service implementations. This class should be extended only in case you wish to implement a new speech recognizer. Please note that the implementation of this service is stateless.

Summary

Nested classes

class RecognitionService.Callback

This class receives callbacks from the speech recognition service and forwards them to the user. 

class RecognitionService.SupportCallback

This class receives callbacks from the speech recognition service and forwards them to the user. 

Constants

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

String SERVICE_META_DATA

Name under which a RecognitionService component publishes information about itself.

Inherited constants

Public constructors

RecognitionService()

Public methods

Context createContext(ContextParams contextParams)

Creates a context with specific properties and behaviors.

int getMaxConcurrentSessionsCount()

Returns the maximal number of recognition sessions ongoing at the same time.

final IBinder onBind(Intent intent)

Return the communication channel to the service.

void onCheckRecognitionSupport(Intent recognizerIntent, RecognitionService.SupportCallback supportCallback)

Queries the service on whether it would support a onStartListening(Intent,Callback) for the same recognizerIntent.

void onCheckRecognitionSupport(Intent recognizerIntent, AttributionSource attributionSource, RecognitionService.SupportCallback supportCallback)

Queries the service on whether it would support a onStartListening(Intent,Callback) for the same recognizerIntent.

void onDestroy()

Called by the system to notify a Service that it is no longer used and is being removed.

void onTriggerModelDownload(Intent recognizerIntent, AttributionSource attributionSource, ModelDownloadListener listener)

Requests the download of the recognizer support for recognizerIntent.

void onTriggerModelDownload(Intent recognizerIntent, AttributionSource attributionSource)

Requests the download of the recognizer support for recognizerIntent.

void onTriggerModelDownload(Intent recognizerIntent)

Requests the download of the recognizer support for recognizerIntent.

Protected methods

abstract void onCancel(RecognitionService.Callback listener)

Notifies the service that it should cancel the speech recognition.

abstract void onStartListening(Intent recognizerIntent, RecognitionService.Callback listener)

Notifies the service that it should start listening for speech.

abstract void onStopListening(RecognitionService.Callback listener)

Notifies the service that it should stop listening for speech.

Inherited methods