React Native SDK Installation Guide
This guide walks you through the process of installing and configuring the Samvyo React Native SDK in your application.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- npm or yarn
- Android Studio (for Android development)
- Xcode (for iOS development)
Step 1: Create a new React Native project
Start by creating a new React Native application using the React Native CLI:
npx @react-native-community/cli@latest init your-app-name
Then navigate to your project directory:
cd your-app-name
Step 2: Install Samvyo SDK and dependencies
Install the Samvyo React Native SDK along with the required WebRTC library:
npm i basic-rn-sdk-3.0@latest
npm i react-native-webrtc
Step 3: Android Configuration
3.1 Update AndroidManifest.xml
Add the following permissions to your AndroidManifest.xml
file. These permissions are necessary for accessing camera, microphone, and other features required for video conferencing:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.MEDIA_PROJECTION" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Why these permissions are needed:
- Camera and audio permissions enable video and voice communication
- Bluetooth permissions allow connecting to audio devices
- Network permissions enable internet connectivity for calls
- Storage permissions allow recording and saving media
- Notification permissions enable call alerts and notifications
- System alert and foreground service permissions support screen sharing functionality
3.2 Configure Screen Sharing
To enable screen sharing capabilities, update your MainApplication.kt
file by adding the following code in the onCreate
method:
import com.oney.WebRTCModule.WebRTCModuleOptions
// Inside the onCreate method
override fun onCreate() {
super.onCreate()
// Configure WebRTC options for screen sharing
val options = WebRTCModuleOptions.getInstance()
options.enableMediaProjectionService = true // Enable foreground service for screen sharing
// ... rest of your onCreate method
}
Step 4: iOS Configuration (Optional)
For iOS deployment, additional configuration is required:
- Update your
Info.plist
file to include camera and microphone usage descriptions - Configure background modes for audio sessions
Troubleshooting
If you encounter any issues during installation or setup:
- Ensure all permissions are correctly added to your Android manifest
- Check that WebRTC is properly initialized
- Verify your Android SDK version is compatible
Next Steps
Now that you've successfully installed the Samvyo React Native SDK, check out the next steps to implement video calling features in your application.