VoiceInput

object VoiceInput

Helpers for voice input. Android speech recognition runs in another app and returns through an Activity result, so the SDK does not record audio itself:

  1. Launch buildRecognitionIntent with an Activity Result launcher.

  2. Read the text with extractTranscript.

  3. Pass it to A2aSession.sendMessage with the recognition locale as locale.

Functions

Link copied to clipboard
fun buildRecognitionIntent(localeTag: String, prompt: String? = null, preferOffline: Boolean = false): Intent
Link copied to clipboard

Best transcript from the recognizer's result, or null if there is none (cancelled or empty).