Overview
The@navai/voice-mobile package provides a complete voice AI solution for React Native applications. It handles WebRTC connections, realtime communication with OpenAI’s Realtime API, and integrates seamlessly with React Native navigation and application functions.
Installation
Quick Start
Core Features
React Native Integration
- WebRTC audio streaming via
react-native-webrtc - Automatic microphone permission handling (Android)
- React Navigation integration
- Mobile-optimized session management
Voice Agent Runtime
- Function calling with mobile and backend functions
- Route-based navigation commands
- Automatic tool execution and response handling
- Context-aware instruction generation
WebRTC Transport
- OpenAI Realtime API WebRTC connection
- Configurable audio constraints
- Remote audio volume control
- Connection state management
Architecture
Package Exports
Hooks
useMobileVoiceAgent- Main React hook for voice integration
Core APIs
createNavaiMobileAgentRuntime- Create agent runtime with toolscreateNavaiMobileBackendClient- Backend API clientcreateReactNativeWebRtcTransport- WebRTC transport layercreateNavaiMobileVoiceSession- Voice session manager
Utilities
loadNavaiFunctions- Load and register mobile functionsresolveNavaiRoute- Resolve route paths from namesextractNavaiRealtimeToolCalls- Extract tool calls from eventsbuildNavaiRealtimeToolResultEvents- Build tool result events
Configuration
resolveNavaiMobileApplicationRuntimeConfig- Resolve app runtime configresolveNavaiMobileRuntimeConfig- Resolve runtime configurationresolveNavaiMobileEnv- Resolve environment variables
Type Exports
See Types Reference for complete type documentation.Platform Support
- iOS 11.0+
- Android API 21+
- React Native 0.60+
Dependencies
react-native-webrtc- WebRTC support (peer dependency)reactandreact-native- React Native framework (peer dependencies)
Next Steps
useMobileVoiceAgent Hook
Main React hook for voice integration
Agent Runtime
Create and configure agent runtime
WebRTC Transport
WebRTC transport configuration
Types Reference
TypeScript types and interfaces