public class RecognitionService.Callback extends Object
RecognitionService.onStartListening(Intent, Callback)
method. Recognizers may call
these methods on any thread.Modifier and Type | Method and Description |
---|---|
void |
beginningOfSpeech()
The service should call this method when the user has started to speak.
|
void |
bufferReceived(byte[] buffer)
The service should call this method when sound has been received.
|
void |
endOfSpeech()
The service should call this method after the user stops speaking.
|
void |
error(int error)
The service should call this method when a network or recognition error occurred.
|
void |
partialResults(Bundle partialResults)
The service should call this method when partial recognition results are available.
|
void |
readyForSpeech(Bundle params)
The service should call this method when the endpointer is ready for the user to start
speaking.
|
void |
results(Bundle results)
The service should call this method when recognition results are ready.
|
void |
rmsChanged(float rmsdB)
The service should call this method when the sound level in the audio stream has changed.
|
public void beginningOfSpeech() throws RemoteException
RemoteException
public void bufferReceived(byte[] buffer) throws RemoteException
buffer
- a buffer containing a sequence of big-endian 16-bit integers representing a
single channel audio stream. The sample rate is implementation dependent.RemoteException
public void endOfSpeech() throws RemoteException
RemoteException
public void error(int error) throws RemoteException
error
- code is defined in SpeechRecognizer
RemoteException
public void partialResults(Bundle partialResults) throws RemoteException
beginningOfSpeech()
and
results(Bundle)
when partial results are ready. This method may be called zero,
one or multiple times for each call to SpeechRecognizer.startListening(Intent)
,
depending on the speech recognition service implementation.partialResults
- the returned results. To retrieve the results in
ArrayList<String> format use Bundle.getStringArrayList(String)
with
SpeechRecognizer.RESULTS_RECOGNITION
as a parameterRemoteException
public void readyForSpeech(Bundle params) throws RemoteException
params
- parameters set by the recognition service. Reserved for future use.RemoteException
public void results(Bundle results) throws RemoteException
results
- the recognition results. To retrieve the results in ArrayList<String>
format use Bundle.getStringArrayList(String)
with
SpeechRecognizer.RESULTS_RECOGNITION
as a parameterRemoteException
public void rmsChanged(float rmsdB) throws RemoteException
rmsdB
- the new RMS dB valueRemoteException