--- title: "React Native SDK" description: "Add voice calls with your agent to an iOS or Android app with @fishaudio/agent-react-native, in Expo or bare React Native" icon: "mobile" --- `@fishaudio/agent-react-native` adds voice calls with your agent to a React Native app. The call runs on the same code as the [Web SDK](/agents/deploy/web-sdk), so connection handling, transcripts, client tools, and end reasons behave the same. The hooks are the [React SDK](/agents/deploy/react-sdk)'s. On top of that, the package handles what phones need: - The microphone permission on Android - The platform audio session and routing (loudspeaker, earpiece, headsets) - Background calls: an Android foreground service and iOS background audio - An Expo config plugin for the native settings It works in Expo apps and in bare React Native apps. Expo is not required. For a ready-made call UI on top of it, see the [React Native widget](/agents/deploy/react-native-widget). The hook API this package builds on. Create session tokens on your backend. Events, client tools, and error codes. ## Requirements - **A native build.** WebRTC is a native module. In Expo, build with `npx expo run:ios` / `run:android` or EAS Build. Expo Go cannot run it (`expo-dev-client` is optional). Bare React Native apps build as usual; see [Bare React Native](#bare-react-native). - **A physical device** for anything involving the microphone. - **Your own backend** to create session tokens, or a [public agent](#public-agent). Never ship an API key inside an app. - **Tested with** Expo SDK 58 and bare React Native 0.88, `@livekit/react-native` 3.2, `@livekit/react-native-webrtc` 150.2, `@livekit/react-native-expo-plugin` 1.2, and `livekit-client` 2.20 to 2.23, on iOS 26 to 27 and Android 17, in debug and release builds. Other versions may work but are untested. ## Install (Expo) ```bash npx expo install @fishaudio/agent-react-native @livekit/react-native @livekit/react-native-webrtc \ @livekit/react-native-expo-plugin @config-plugins/react-native-webrtc livekit-client ``` `npx expo install` adds the three config plugins to `app.json` for you. If you installed with npm or yarn instead, add them yourself: ```json app.json { "expo": { "plugins": [ "@livekit/react-native-expo-plugin", "@config-plugins/react-native-webrtc", [ "@fishaudio/agent-react-native", { "microphonePermission": "Talk to our assistant by voice." } ] ] } } ``` Then build the native app with `npx expo run:ios --device` or `npx expo run:android --device`. Rebuild whenever you add a package with native code. After changing a plugin or its options, run `npx expo prebuild` first: once the `ios` and `android` folders exist, `run:ios` and `run:android` do not apply plugin changes. A JavaScript reload picks up neither. | Plugin option | Default | Description | | ---------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `microphonePermission` | `"Allow $(PRODUCT_NAME) to use the microphone for voice calls."` | iOS microphone prompt text. `false` leaves `NSMicrophoneUsageDescription` alone | | `backgroundAudio` | `true` | Adds the iOS `audio` background mode, so calls continue in the background and with the screen locked | Android needs no configuration: the package's manifest adds the microphone, audio, and foreground-service permissions and the service itself when the app is built. ## Bare React Native Without Expo, install the packages without the config plugins and set the native options yourself: ```bash npm install @fishaudio/agent-react-native @livekit/react-native @livekit/react-native-webrtc livekit-client ``` Follow the [LiveKit React Native installation](https://github.com/livekit/client-sdk-react-native#installation) for its native setup. It replaces the two LiveKit and WebRTC config plugins. In short: - Android `MainApplication.kt`: call `LiveKitReactNative.setup(this, AudioType.CommunicationAudioType())` in `onCreate`. - iOS `AppDelegate.swift`: `import livekit_react_native`, then call `LivekitReactNative.setup()` in `didFinishLaunchingWithOptions`. - iOS `Podfile`: LiveKit's WebRTC pod comes from LiveKit's own spec repo. Add both sources at the top, then run `cd ios && pod install --repo-update`: ```ruby Podfile source 'https://github.com/livekit/podspecs.git' source 'https://cdn.cocoapods.org/' ``` Add the microphone text, and the `audio` background mode so calls continue in the background: ```xml Info.plist NSMicrophoneUsageDescription Talk to our assistant by voice. UIBackgroundModes audio ``` Android needs nothing extra: autolinking registers the package's module, and its manifest brings the permissions and the foreground service. Build with `npx react-native run-ios` or `run-android`. ## Set up the entry file `setupFishAgent()` installs the WebRTC globals the SDK runs on. Call it before your app's modules load: put it in a file of its own and import that file first in your entry file. A call in the entry file's body is not enough, since every import in a file runs before its body. `startSession` also installs the globals if they are missing, so a forgotten call does not break calls, but code that touches WebRTC earlier would fail. ```ts setupFishAgent.ts import { setupFishAgent } from "@fishaudio/agent-react-native"; setupFishAgent(); ``` ```ts index.ts (expo-router) import "./setupFishAgent"; import "expo-router/entry"; ``` ```ts index.ts (Expo, no router) import "./setupFishAgent"; import { registerRootComponent } from "expo"; import App from "./App"; registerRootComponent(App); ``` ```ts index.js (bare React Native) import "./setupFishAgent"; import { AppRegistry } from "react-native"; import App from "./App"; import { name as appName } from "./app.json"; AppRegistry.registerComponent(appName, () => App); ``` With expo-router (the default `create-expo-app` template), also point `main` in `package.json` at the new file: `"main": "index.ts"`. ## Quick start ```tsx SupportCall.tsx import { useAgentMessages, useConversation, } from "@fishaudio/agent-react-native"; import { useRef } from "react"; import { Button, FlatList, Text, View } from "react-native"; export default function SupportCall() { const conversation = useConversation( { clientTools: { show_order: async ({ orderId }) => ({ shown: true }) } }, { callNotification: { title: "Talking to support" } } ); const messages = useAgentMessages(conversation.session); const attempt = useRef(0); const start = async () => { const current = ++attempt.current; const sessionToken = await fetch("https://api.example.com/agent-session", { method: "POST", }).then(r => r.json()); // The user hung up while the token was on its way. if (current !== attempt.current) return; await conversation.startSession({ sessionToken }); }; const hangUp = () => { attempt.current++; void conversation.endSession(); }; return ( {conversation.status} ยท {conversation.mode}