# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods | Inherited Methods

# RecognitionService.Callback

`public class RecognitionService.Callback`
`extends Object` ``

java.lang.Object
↳ | android.speech.RecognitionService.Callback

This class receives callbacks from the speech recognition service and forwards them to the user. An instance of this class is passed to the `RecognitionService#onStartListening(Intent, Callback)` method. Recognizers may call these methods on any thread.

## Summary

### Public methods
`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.
`AttributionSource` | `getCallingAttributionSource()` Gets the permission identity of the calling app.
`int` | `getCallingUid()` Return the Linux uid assigned to the process that sent you the current transaction that is being processed.
`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.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public methods

### beginningOfSpeech

    public void beginningOfSpeech ()

The service should call this method when the user has started to speak.

Throws
`RemoteException` |

### bufferReceived

    public void bufferReceived (byte[] buffer)

The service should call this method when sound has been received. The purpose of this function is to allow giving feedback to the user regarding the captured audio.

Parameters
`buffer` | `byte`: a buffer containing a sequence of big-endian 16-bit integers representing a single channel audio stream. The sample rate is implementation dependent.

Throws
`RemoteException` |

### endOfSpeech

    public void endOfSpeech ()

The service should call this method after the user stops speaking.

Throws
`RemoteException` |

### error

    public void error (int error)

The service should call this method when a network or recognition error occurred.

Parameters
`error` | `int`: code is defined in `SpeechRecognizer` Value is `SpeechRecognizer.ERROR_NETWORK_TIMEOUT`, `SpeechRecognizer.ERROR_NETWORK`, `SpeechRecognizer.ERROR_AUDIO`, `SpeechRecognizer.ERROR_SERVER`, `SpeechRecognizer.ERROR_CLIENT`, `SpeechRecognizer.ERROR_SPEECH_TIMEOUT`, `SpeechRecognizer.ERROR_NO_MATCH`, `SpeechRecognizer.ERROR_RECOGNIZER_BUSY`, `SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS`, `SpeechRecognizer.ERROR_TOO_MANY_REQUESTS`, `SpeechRecognizer.ERROR_SERVER_DISCONNECTED`, `SpeechRecognizer.ERROR_LANGUAGE_NOT_SUPPORTED`, or `SpeechRecognizer.ERROR_LANGUAGE_UNAVAILABLE`

Throws
`RemoteException` |

### getCallingAttributionSource

    public AttributionSource getCallingAttributionSource ()

Gets the permission identity of the calling app. If you want to attribute the mic access to the calling app you can create an attribution context via `Context.createContext(android.content.ContextParams)` and passing this identity to `ContextParams.Builder.setNextAttributionSource(AttributionSource)`.

Returns
`AttributionSource` | The permission identity of the calling app. This value cannot be `null`.

See also:

- `ContextParams.Builder.setNextAttributionSource(AttributionSource)`

### getCallingUid

    public int getCallingUid ()

Return the Linux uid assigned to the process that sent you the current transaction that is being processed. This is obtained from `Binder#getCallingUid()`.

Returns
`int` |

### partialResults

    public void partialResults (Bundle partialResults)

The service should call this method when partial recognition results are available. This method can be called at any time between `beginningOfSpeech()` and `results(android.os.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.

Parameters
`partialResults` | `Bundle`: the returned results. To retrieve the results in ArrayList<String> format use `Bundle#getStringArrayList(String)` with `SpeechRecognizer#RESULTS_RECOGNITION` as a parameter

Throws
`RemoteException` |

### readyForSpeech

    public void readyForSpeech (Bundle params)

The service should call this method when the endpointer is ready for the user to start speaking.

Parameters
`params` | `Bundle`: parameters set by the recognition service. Reserved for future use.

Throws
`RemoteException` |

### results

    public void results (Bundle results)

The service should call this method when recognition results are ready.

Parameters
`results` | `Bundle`: the recognition results. To retrieve the results in `ArrayList<String>` format use `Bundle#getStringArrayList(String)` with `SpeechRecognizer#RESULTS_RECOGNITION` as a parameter

Throws
`RemoteException` |

### rmsChanged

    public void rmsChanged (float rmsdB)

The service should call this method when the sound level in the audio stream has changed. There is no guarantee that this method will be called.

Parameters
`rmsdB` | `float`: the new RMS dB value

Throws
`RemoteException` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*