Expo

Speech Recognition

Setting up expo-speech-recognition for useSpeechRecognition and the DocyrusAgent microphone button.

iOSAndroid

Overview

useSpeechRecognition and the DocyrusAgent mic button (DocyrusAgentChatInputMicButton / DocyrusAgentChatInputMic) use expo-speech-recognition. It is an optional peer: without it (and always in Expo Go, which cannot load its native code) the hook reports isSupported: false and the mic button is hidden, so the rest of the chat keeps working.

Installation

npx expo install expo-speech-recognition
Required Packages(1 package)
pnpm add expo-speech-recognition

Expo Configuration

Add the config plugin, then create a development build (npx expo run:ios / eas build --profile development):

{
  plugins: [
    [
      'expo-speech-recognition',
      {
        microphonePermission: 'Allow $(PRODUCT_NAME) to use the microphone for voice prompts.',
        speechRecognitionPermission: 'Allow $(PRODUCT_NAME) to transcribe your voice prompts.'
      }
    ]
  ]
}

The plugin writes NSMicrophoneUsageDescription / NSSpeechRecognitionUsageDescription on iOS and RECORD_AUDIO on Android. Permissions are requested on the first start().

Behaviour

SituationisSupportedMic button
Dev / production build with the moduletrueVisible
Expo GofalseHidden
Module not installedfalseHidden
Device reports recognition unavailablefalseHidden
Permission deniedtrue (error = 'not-allowed')Visible, recording doesn't start

On this page