Develop

Speech recognition

Updated: Dec 1, 2026
Android apps can use the standard android.speech⁠ APIs for speech-to-text on Meta Horizon OS. No Meta SDK is required.
Device support for speech recognition
Speech recognition requires Horizon OS v210 or later. On-device recognition supports Meta VR Glasses, Meta Quest 3, and Meta Quest 3S. Meta Quest 2 and Meta Quest Pro use cloud recognition only. Cloud recognition supports English in all regions and 23 additional languages.

Before you begin

Add RECORD_AUDIO and the speech recognition service query as direct children of the <manifest> element:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
    <intent>
        <action android:name="android.speech.RecognitionService" />
    </intent>
</queries>
Request RECORD_AUDIO at runtime before starting recognition. The <queries> entry is required for apps that target Android 11 or later. For the runtime permission flow, see Request runtime permissions⁠.

Choose a recognition route

Use the factory that matches your privacy, connectivity, and device requirements:
RequirementFactory and behavior
Let Horizon OS choose the route
Use SpeechRecognizer.createSpeechRecognizer(context). On Horizon OS v210 or later, this recognizer uses cloud recognition when the device has validated internet access, and uses on-device recognition when offline on Meta VR Glasses, Meta Quest 3, and Meta Quest 3S.
Keep recognition on the device
On Meta VR Glasses, Meta Quest 3, and Meta Quest 3S, check SpeechRecognizer.isOnDeviceRecognitionAvailable(context), then use SpeechRecognizer.createOnDeviceSpeechRecognizer(context). This route does not send audio to cloud recognition.
Prefer local recognition with the default factory
Set RecognizerIntent.EXTRA_PREFER_OFFLINE to true. The request returns ERROR_LANGUAGE_NOT_SUPPORTED on devices without on-device recognition.
Guard the on-device factory with isOnDeviceRecognitionAvailable() because createOnDeviceSpeechRecognizer() throws UnsupportedOperationException when the device has no on-device recognizer.
Create and use SpeechRecognizer on your app’s main thread:
val recognizer = if (strictlyOnDevice) {
    if (!SpeechRecognizer.isOnDeviceRecognitionAvailable(this)) {
        return
    }
    SpeechRecognizer.createOnDeviceSpeechRecognizer(this)
} else {
    SpeechRecognizer.createSpeechRecognizer(this)
}
recognizer.setRecognitionListener(listener)

Supported languages

Cloud recognition supports English in every region (for example en-US, en-GB, en-AU, and en-CA) and 23 additional languages:
LanguagePrimary BCP 47 tag
Arabic
ar-EG
Chinese (Simplified)
zh-CN
Dutch
nl-NL
English
en-US, en-GB (all regions)
Filipino (Tagalog)
fil-PH, tl-PH
Finnish
fi-FI
French
fr-FR
German
de-DE
Hebrew
he-IL
Hindi
hi-IN
Indonesian
id-ID
Italian
it-IT
Japanese
ja-JP
Korean
ko-KR
Malay
ms-MY
Marathi
mr-IN
Polish
pl-PL
Portuguese
pt-BR
Russian
ru-RU
Spanish
es-ES
Swedish
sv-SE
Tamil
ta-IN
Thai
th-TH
Turkish
tr-TR
Any regional tag for a supported language uses that language’s cloud model (for example es-MX and pt-PT). Chinese supports Simplified Chinese (zh-CN and zh); Traditional Chinese (zh-TW, zh-HK, and zh-Hant) is unsupported on the cloud route.
When a request specifies a language the active route does not recognize:
  • createSpeechRecognizer() transcribes the session in en-US on the active route (cloud or on-device).
  • createOnDeviceSpeechRecognizer() returns ERROR_LANGUAGE_NOT_SUPPORTED.
Call SpeechRecognizer.checkRecognitionSupport() before showing voice controls to confirm language support on the active route. Support queries continue to respond while the device microphone is muted.
On the cloud route, RecognitionSupport.getOnlineLanguages() returns the supported cloud tags and includes the requested tag when it is a supported regional variant. On the on-device route, RecognitionSupport reports getInstalledOnDeviceLanguages(), getPendingOnDeviceLanguages(), and getSupportedOnDeviceLanguages() for supported languages, and returns ERROR_LANGUAGE_NOT_SUPPORTED for unsupported languages. Call SpeechRecognizer.triggerModelDownload() when a supported on-device language model needs to be downloaded.

Configure the request

Set the language model explicitly so your app gets stable transcript semantics:
  • Use RecognizerIntent.LANGUAGE_MODEL_FREE_FORM for dictated prose.
  • Use RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH for search-style text.
  • A missing, malformed, or unknown language model uses search-style text.
For English cloud requests, LANGUAGE_MODEL_FREE_FORM and LANGUAGE_MODEL_WEB_SEARCH select separate models. Cloud requests in the other 23 languages use one model and return lowercase text without punctuation.
Set RecognizerIntent.EXTRA_LANGUAGE with a BCP 47 tag. When EXTRA_LANGUAGE is omitted, cloud recognition uses the device locale and on-device recognition defaults to en-US.
val request = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
    putExtra(
        RecognizerIntent.EXTRA_LANGUAGE_MODEL,
        RecognizerIntent.LANGUAGE_MODEL_FREE_FORM,
    )
    putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US")
}
recognizer.startListening(request)

Handle results and lifecycle

Implement both RecognitionListener.onPartialResults() and onResults(). Read the first entry in the string list stored under SpeechRecognizer.RESULTS_RECOGNITION. Partial results replace the previous partial transcript; treat each callback as the current text. If a session ends without a final hypothesis, onResults() delivers the last partial result, which can be an empty string. Treat an empty transcript as a no-result case in your UI.
Use these lifecycle calls on the main thread:
  • Call stopListening() when the user finishes speaking and keep waiting for onResults() or onError().
  • Call cancel() to discard the active request.
  • Wait for onResults() or onError() before starting another request.
  • Call destroy() when the recognizer is no longer needed.
The service handles one active recognition session at a time. An overlapping request can return ERROR_RECOGNIZER_BUSY or ERROR_CLIENT.

Handle errors

Handle each error in RecognitionListener.onError() and keep the retry under user control.
ErrorMeaning and response
ERROR_INSUFFICIENT_PERMISSIONS
The app lacks RECORD_AUDIO, or cloud recognition is unavailable to the user. Request the permission. On Meta VR Glasses, Meta Quest 3, and Meta Quest 3S, retry with on-device recognition when the permission is already granted.
ERROR_LANGUAGE_NOT_SUPPORTED
The device has no on-device recognizer for an EXTRA_PREFER_OFFLINE request, or createOnDeviceSpeechRecognizer() (or an on-device support or download check) received an unsupported language. Check isOnDeviceRecognitionAvailable() and checkRecognitionSupport() before starting recognition.
ERROR_LANGUAGE_UNAVAILABLE
The requested on-device language is supported, and its model needs to be downloaded. Call triggerModelDownload(), wait for completion, and let the user retry.
ERROR_RECOGNIZER_BUSY
Another recognition session is active or the on-device recognizer is still initializing. Wait, then let the user retry.
ERROR_AUDIO
Audio capture could not start, including while a phone or VoIP call is active. Retry after audio capture becomes available.
ERROR_NETWORK or ERROR_NETWORK_TIMEOUT
Cloud recognition lost its connection or timed out. Let the user retry or use on-device recognition when available.
ERROR_SERVER
Cloud recognition could not start, authentication failed, or the recognition service hit another server or provider error. Let the user retry.
ERROR_CLIENT
The default recognizer is unavailable, the app started an overlapping request, or request preparation failed. End the active request before retrying.
ERROR_NO_MATCH
Cloud recognition produced no transcript. Let the user try again. On-device silence can instead deliver an empty string through onResults().
For the complete API contract, see the Android references for SpeechRecognizer⁠, RecognizerIntent⁠, and RecognitionListener⁠.