damp-kite-83575
11/01/2025, 5:13 PMConfiguration Details:
Expo app.json:
{
"plugins": [
"@config-plugins/react-native-webrtc",
[
"@livekit/react-native-expo-plugin",
{
"android": {
"audioType": "communication"
}
]
]
],
"android": {
"permissions": [
"FOREGROUND_SERVICE",
"FOREGROUND_SERVICE_MICROPHONE",
"FOREGROUND_SERVICE_MEDIA_PROJECTION",
"FOREGROUND_SERVICE_MEDIA_PLAYBACK",
"FOREGROUND_SERVICE_CONNECTED_DEVICE",
"POST_NOTIFICATIONS"
],
"foregroundService": {
"type": "microphone|mediaPlayback",
"notificationTitle": "Call Active",
"notificationBody": "Your call is running in the background."
}
},
"ios": {
"infoPlist": {
"UIBackgroundModes": [
"audio",
"voip",
"fetch",
"remote-notification",
"processing"
]
}
}
}
Android Setup:
On Android, I’m using @supersami/rn-foreground-service to keep the process alive and maintain audio focus in background.
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
ReactNativeForegroundService.register({
config: {
alert: false,
onServiceErrorCallBack: () => {},
},
});
The foreground service runs fine.
However, audio capture (microphone) stops once the app goes background or screen locks.
iOS Setup
Enabled Background Modes in Xcode:
• Audio
• VoIP
• Background fetch
• Remote notifications
And configured:
await AudioSession.configureAudio({
ios: { defaultOutput: "speaker" },
});
await AudioSession.startAudioSession();
However, as soon as I switch to another app or lock the screen:
• iOS suspends the app
• LiveKit connection drops silently
• Audio session stops transmitting
Even after unlocking the screen, the session doesn’t automatically resume unless the user reopens the app.
Call Implementation :
import {
AudioSession,
LiveKitRoom,
} from "@livekit/react-native";
import React, { useEffect, useState } from "react";
import { SafeAreaView, TouchableOpacity, View, Platform } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import RNForegroundService from "@supersami/rn-foreground-service";
export default function CallScreen({ route }) {
const [isMuted, setIsMuted] = useState(false);
useEffect(() => {
const init = async () => {
await startNativeAudioSession();
if (Platform.OS === "android") await startForegroundService();
};
init();
return () => {
AudioSession.stopAudioSession();
RNForegroundService.stopAll();
};
}, []);
const startNativeAudioSession = async () => {
await AudioSession.configureAudio({
android: {
preferredOutputList: ["bluetooth", "headset", "speaker", "earpiece"],
audioTypeOptions: {
manageAudioFocus: true,
audioMode: "inCommunication",
audioAttributesUsageType: "voiceCommunication",
audioAttributesContentType: "speech",
},
},
ios: { defaultOutput: "speaker" },
});
await AudioSession.startAudioSession();
};
return (
<SafeAreaView>
<LiveKitRoom
serverUrl={serverUrl}
token={route.params.token}
connect={true}
audio={true}
video={false}
>
<View>
<TouchableOpacity
onPress={() => {
setIsMuted(!isMuted);
}}
>
<Ionicons name={isMuted ? "mic-off" : "mic"} size={32} />
</TouchableOpacity>
</View>
</LiveKitRoom>
</SafeAreaView>
);
}
In Android, I want to keep the microphone active and continue transmitting audio during background or screen lock.
For iOS, how to properly configure iOS so that audio capture continues when the app is backgrounded or the screen is locked.
Any guidance or examples for both Android and iOS background audio handling would be really helpfultall-airline-16756
11/01/2025, 5:13 PMtall-airline-16756
11/01/2025, 5:14 PMAndroidManifest.xml, including FOREGROUND_SERVICE and permissions for microphone and media playback.
• Using a foreground service is key to keeping your app active in the background. I recommend @supersami/rn-foreground-service to manage this smoothly. Don’t forget to configure the service with a notification so users know there’s an ongoing call.
• If you’d like a detailed example, check out the CallService.android.ts example—it’s a great resource.
iOS:
• In Xcode, be sure to enable Background Modes, especially "Audio" and "VoIP" under UIBackgroundModes.
• If you’re working with iOS 18 or later, configuring multitasking camera access in your AppDelegate is important.
• Integrating CallKit can really strengthen background handling. The CallService.ios.ts example offers a helpful guide.
• Also, consider using the useIOSAudioManagement hook to adapt audio settings dynamically during calls.
For both Android and iOS, don’t forget to request runtime permissions for the microphone and camera—libraries like react-native-permissions make this easier.
I hope these steps make things clearer and help you get your background audio and mic working perfectly. If you run into any bumps or have more questions, I’m here to help—just let me know!
Sources: ios/LivekitReactNativeModule.m | Camera & microphone | LiveKit Docsdamp-kite-83575
11/01/2025, 5:28 PMtall-airline-16756
11/01/2025, 5:29 PM{
"expo": {
"plugins": [
"@livekit/react-native-expo-plugin",
"@config-plugins/react-native-webrtc"
],
"android": {
"permissions": [
"CAMERA",
"RECORD_AUDIO",
"INTERNET",
"MODIFY_AUDIO_SETTINGS",
"FOREGROUND_SERVICE"
],
"foregroundService": {
"type": "microphone|mediaPlayback",
"notificationTitle": "Call Active",
"notificationBody": "Your call is running in the background."
}
},
"ios": {
"infoPlist": {
"NSCameraUsageDescription": "Allow access to camera for video calls",
"NSMicrophoneUsageDescription": "Allow access to microphone for voice calls",
"UIBackgroundModes": [
"audio",
"voip"
]
}
}
}
}
2. Android Foreground Service:
• Consider using @supersami/rn-foreground-service to keep your app running smoothly in the background. It’s great to configure it with a notification so users know their call is active.
• Don’t forget to add the FOREGROUND_SERVICE permission in your `app.json`—this is key!
3. iOS Background Modes:
• Make sure "Audio" and "VoIP" are enabled in UIBackgroundModes within your app.json.
• Using the useIOSAudioManagement hook can really help with managing audio sessions dynamically during calls.
4. Build the App:
• When you’re ready, run npx expo run:android or npx expo run:ios to build your app with all the necessary native modules included.
These steps should help fix the microphone issue when your app is in the background or the screen is locked. If anything feels unclear or you run into any other questions, please don’t hesitate to reach out—I’m here to support you!
Sources: Documentation/iOSInstallation.md | android/src/main/java/com/livekit/reactnative/LivekitReactNativeModule.kt | Camera & microphone | LiveKit Docs | README.md | README.mddamp-kite-83575
11/01/2025, 5:32 PMtall-airline-16756
11/01/2025, 5:33 PM@supersami/rn-foreground-service in your React Native Expo project for keeping the microphone active during calls in the background, I've put together some easy steps for you to follow:
1. Install Required Dependencies:
npx expo install livekit-client @livekit/react-native @livekit/react-native-expo-plugin @livekit/react-native-webrtc @config-plugins/react-native-webrtc
npm install @supersami/rn-foreground-service
2. Update app.json:
{
"expo": {
"plugins": [
"@livekit/react-native-expo-plugin",
"@config-plugins/react-native-webrtc"
],
"android": {
"permissions": [
"FOREGROUND_SERVICE",
"FOREGROUND_SERVICE_MICROPHONE",
"RECORD_AUDIO",
"MODIFY_AUDIO_SETTINGS"
],
"foregroundService": {
"type": "microphone|mediaPlayback",
"notificationTitle": "Call Active",
"notificationBody": "Your call is running in the background."
}
},
"ios": {
"infoPlist": {
"UIBackgroundModes": [
"audio",
"voip"
]
}
}
}
}
3. Configure Foreground Service:
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
export function setupCallService() {
ReactNativeForegroundService.register({
config: {
alert: false,
onServiceErrorCallBack: () => {
console.error("Foreground service error occurred");
},
},
});
}
export async function startCallService() {
await ReactNativeForegroundService.start({
id: 3456,
title: "LiveKit Call",
message: "Call in progress",
importance: "none",
vibration: false,
icon: "ic_launcher",
ServiceType: "microphone",
});
}
export async function stopCallService() {
await ReactNativeForegroundService.stop();
}
4. Initialize in App:
import { registerGlobals, AudioSession } from "@livekit/react-native";
useEffect(() => {
registerGlobals();
AudioSession.startAudioSession();
setupCallService();
return () => {
AudioSession.stopAudioSession();
};
}, []);
5. Build and Test:
• Run npx expo run:android or eas build --platform android to create a development build.
• Try testing on a physical device since background behavior can be different compared to simulators.
Following these steps should help keep your microphone active even when your app is in the background or the screen is locked. If you run into any issues or have questions, please don’t hesitate to reach out—I’m here to help!
Sources: Expo quickstart | LiveKit docs | README.md | patches/@supersami+rn-foreground-service+2.1.0.patch | docs/index.htmldamp-kite-83575
11/01/2025, 5:37 PMtall-airline-16756
11/01/2025, 5:38 PM<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
2. Declare Foreground Service:
<service android:name="com.supersami.foregroundservice.ForegroundService"
android:foregroundservicetype="microphone|mediaPlayback"/>
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask"/>
3. Start Foreground Service Before Backgrounding:
await ReactNativeForegroundService.start({
id: 3456,
title: "Call in progress",
message: "LiveKit is using the microphone",
icon: "ic_launcher",
ServiceType: "microphone",
importance: "none",
vibration: false,
});
4. Initialize WebRTC and Audio Session:
import { registerGlobals, AudioSession } from "@livekit/react-native";
registerGlobals();
useEffect(() => {
const setup = async () => {
await AudioSession.configureAudio({
android: { audioTypeOptions: "communication" },
});
await AudioSession.startAudioSession();
};
setup();
return () => {
AudioSession.stopAudioSession();
};
}, []);
5. Troubleshooting:
• If you’re on Android devices with strict background restrictions (like Xiaomi or Huawei), try disabling battery optimization for your app.
• Make sure the foreground service starts right away without any delays.
• It’s also a good idea to test on different Android versions since behavior can vary.
I hope these steps help you get everything running smoothly! If you run into any more issues or have questions, please don’t hesitate to reach out—I’m here to support you.
Sources: example/src/types/Foreground.d.ts | patches/@supersami+rn-foreground-service+2.1.0.patchdamp-kite-83575
11/01/2025, 7:52 PMtall-airline-16756
11/01/2025, 7:52 PM<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
Make sure these permissions are correctly added so your app can access the microphone and run foreground services.
2. Declare Foreground Service:
<service android:name="com.supersami.foregroundservice.ForegroundService"
android:foregroundservicetype="microphone|mediaPlayback"/>
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask"/>
This declaration tells Android about your foreground service and its purpose.
3. Start Foreground Service with Notification:
await ReactNativeForegroundService.start({
id: 3456,
title: "LiveKit Call",
message: "Call in progress",
importance: "high",
vibration: false,
icon: "ic_launcher",
});
Just a quick reminder to ensure the icon you use is a valid drawable resource in your Android project—something like ic_launcher usually works well.
4. Register Foreground Service:
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
ReactNativeForegroundService.register();
It’s best to call this early on in your app’s lifecycle, for example in your index.tsx file, so everything is set up properly.
5. Use Expo Development Build:
npx expo install expo-dev-client
npx expo run:android
Just a heads-up: foreground services need a custom development build to work, so they won’t function with Expo Go.
6. Start Audio Session:
import { AudioSession } from "@livekit/react-native";
await AudioSession.startAudioSession();
Starting the audio session helps keep the microphone active even when your app goes to the background.
Give these steps a try, and hopefully, they’ll resolve the notification and microphone issues you’re experiencing. If you run into any trouble or have more questions, please don’t hesitate to reach out—I’m here to help!
Sources: README.md | index.tsx | Expo quickstart | LiveKit docsdamp-kite-83575
11/01/2025, 8:01 PMtall-airline-16756
11/01/2025, 8:02 PMic_launcher icon in your React Native project! You'll find it in the android/app/src/main/res/mipmap directory. This directory contains several folders tailored for different screen densities, such as:
• mipmap-mdpi
• mipmap-hdpi
• mipmap-xhdpi
• mipmap-xxhdpi
• mipmap-xxxhdpi
If you're working with adaptive icons, the ic_launcher.xml file is located in the mipmap-anydpi-v26 folder. This file points to:
• @drawable/ic_launcher_foreground for the foreground image
• @drawable/ic_launcher_background for the background color or image
Here’s how you can customize your icon:
1. Swap out the PNG files in each mipmap- folder if you’re using static icons.
2. For adaptive icons, update the ic_launcher_foreground and ic_launcher_background drawables found in the res/drawable folder.
3. Make sure your AndroidManifest.xml references @mipmap/ic_launcher for both the android:icon and android:roundIcon attributes.
If you’d like, I’m here to guide you through any part of this process or answer any questions you might have about customizing or replacing your icon. Just let me know!
Sources: examples/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_roun... | ci/android/app/src/main/AndroidManifest.xml | src/callservice/CallService.android.ts | sample-app-record-local/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xm... | examples/llama.android/app/src/main/res/mipmap-anydpi/ic_launcher.xmldamp-kite-83575
11/01/2025, 8:20 PMtall-airline-16756
11/01/2025, 8:20 PMServiceType parameter might be missing or not set up quite right. No worries—let's walk through how to fix this together:
1. Update your AndroidManifest.xml file:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<service android:name="com.supersami.foregroundservice.ForegroundService"
android:foregroundservicetype="microphone|mediaPlayback"/>
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask"
android:foregroundservicetype="microphone|mediaPlayback"/>
2. Make sure to pass the ServiceType when you start the service:
await ReactNativeForegroundService.start({
id: 3456,
title: "LiveKit Call",
message: "Call in progress",
importance: "high",
vibration: false,
icon: "ic_launcher",
ServiceType: "microphone",
});
Just a quick tip: the ServiceType here needs to match one of the types you declared in the android:foregroundServiceType attribute in your manifest, like microphone or mediaPlayback.
If you have any questions or want me to help you with the next steps, please don’t hesitate to reach out. I’m here to help!
Sources: example/src/types/Foreground.d.tsdamp-kite-83575
11/01/2025, 8:23 PMdamp-kite-83575
11/01/2025, 8:24 PMtall-airline-16756
11/01/2025, 8:25 PM<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
Starting with Android 13, it’s important to request the POST_NOTIFICATIONS permission at runtime to make sure notifications can show up.
2. Verify Foreground Service Declaration:
<service android:name="com.supersami.foregroundservice.ForegroundService"
android:foregroundservicetype="microphone|mediaPlayback"/>
3. Configure Notification Channel:
<meta-data android:name="com.supersami.foregroundservice.notification_channel_name"
android:value="Call"/>
<meta-data android:name="com.supersami.foregroundservice.notification_channel_description"
android:value="Description"/>
4. Set Notification Importance:
await ReactNativeForegroundService.start({
id: 3456,
title: "LiveKit Call",
message: "Call in progress",
importance: "high",
vibration: false,
icon: "ic_launcher",
ServiceType: "microphone",
});
Make sure the importance is set to "high" so the notification is clearly visible.
5. Check Icon Resource:
Please double-check that the ic_launcher icon is available in your res/mipmap folders.
Following these steps usually does the trick! If you still don’t see the notification after trying this, just let me know—I’m here to help you through it.
Sources: example/src/types/Foreground.d.ts | livekit-android-sdk/src/main/java/io/livekit/android/room/track/LocalScreen... | Screen sharing | LiveKit docs | src/callservice/CallService.android.tsdamp-kite-83575
11/02/2025, 8:41 AMtall-airline-16756
11/02/2025, 8:42 AMMainApplication.kt or MainActivity.java to enable background processing. Expo takes care of the native configurations for you through config plugins and the build process, making things a lot smoother!
Here’s a friendly step-by-step guide for Expo:
1. Install Required Dependencies:
npm install @livekit/react-native @livekit/react-native-webrtc livekit-client @supersami/rn-foreground-service
2. Update app.json:
{
"expo": {
"android": {
"permissions": [
"FOREGROUND_SERVICE",
"FOREGROUND_SERVICE_MICROPHONE",
"POST_NOTIFICATIONS"
],
"manifest": {
"application": {
"service": [
{
"@android:name": "com.supersami.foregroundservice.ForegroundService",
"@android:foregroundServiceType": "microphone|mediaPlayback"
}
]
}
}
}
}
}
3. Use the LiveKit Expo Plugin:
{
"plugins": [
"@livekit/expo-plugin"
]
}
4. Start Foreground Service in JavaScript:
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
export async function startCallService() {
await ReactNativeForegroundService.start({
id: 3456,
title: "LiveKit Call",
message: "Call in progress",
importance: "high",
icon: "ic_launcher",
});
}
5. Register WebRTC Globals:
import { registerGlobals } from "@livekit/react-native";
registerGlobals();
Following these steps should have your background processing running smoothly without the need to touch native files. If anything feels unclear or you hit any bumps along the way, please don’t hesitate to reach out—I’m here to help!
Sources: docs/index.html | Expo quickstart | LiveKit docs | src/types/Foreground.d.tsdamp-kite-83575
11/02/2025, 9:23 AMtall-airline-16756
11/02/2025, 9:24 AMapp.json like this:
{
"plugins": [
"livekit-react-native-expo-plugin"
]
}
• Then, build your app using expo build:ios or npx expo run:ios.
3. Integrate CallKit (Optional for Robust Background Support):
• If you want smoother background call handling, install react-native-callkeep and set it up to register calls with iOS.
• Use RNCallKeep.startCall() and RNCallKeep.endCall() to manage your calls effectively.
4. Optional: Enable Multi-tasking Camera Access (iOS 18+):
• If your app needs camera access while in the background, you can enable it in your AppDelegate like this:
#import "WebRTCModuleOptions.h"
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
options.enableMultitaskingCameraAccess = YES;
Following these steps will help your app keep audio processing and connectivity going smoothly in the background. If you have any questions or want me to walk you through any part, just let me know—I’m here to help!
Sources: docs/index.html | Expo quickstart | LiveKit docsdamp-kite-83575
11/02/2025, 9:57 AMtall-airline-16756
11/02/2025, 9:59 AMnpm install react-native-callkeep
2. Configure CallKit Service:
import RNCallKeep, { AudioSessionCategoryOption, AudioSessionMode } from "react-native-callkeep";
export function setupCallService() {
const options = {
ios: {
appName: "LiveKitReactNative",
includeCallsInRecents: false,
audioSession: {
categoryOptions:
AudioSessionCategoryOption.allowAirPlay +
AudioSessionCategoryOption.allowBluetooth +
AudioSessionCategoryOption.allowBluetoothA2DP +
AudioSessionCategoryOption.defaultToSpeaker,
mode: AudioSessionMode.videoChat,
},
},
android: {
alertTitle: "Permissions required",
alertDescription: "This application needs to access your phone accounts",
cancelButton: "Cancel",
okButton: "Ok",
imageName: "phone_account_icon",
foregroundService: {
channelId: "io.livekit.reactnative",
channelName: "Foreground Service",
notificationTitle: "LiveKit Call in progress",
},
},
};
RNCallKeep.setSettings(options);
}
3. Handle Audio Session Events:
import { RTCAudioSession } from "@livekit/react-native-webrtc";
RNCallKeep.addEventListener("didActivateAudioSession", () => {
RTCAudioSession.audioSessionDidActivate();
});
RNCallKeep.addEventListener("didDeactivateAudioSession", () => {
RTCAudioSession.audioSessionDidDeactivate();
});
4. Start and Stop Call Service:
export async function startCallService() {
const uuid = "1932b99c-4fe1-4bf4-897f-763bc4dc21c2";
const handle = "1234567";
const contactIdentifier = "Caller Contact";
RNCallKeep.startCall(uuid, handle, contactIdentifier, "number", true);
RNCallKeep.reportConnectingOutgoingCallWithUUID(uuid);
setTimeout(() => {
RNCallKeep.reportConnectedOutgoingCallWithUUID(uuid);
}, 100);
}
export async function stopCallService() {
RNCallKeep.endCall(uuid);
}
5. Configure VoIP Background Mode:
• Simply add the following to your `Info.plist`:
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
<string>audio</string>
</array>
• And don’t forget to enable Background Modes in Xcode under Signing & Capabilities:
◦ Make sure to check Voice over IP and Audio, AirPlay, and Picture in Picture.
6. Optional: Enable Background Camera Access (iOS 18+):
import { WebRTCModuleOptions } from "@livekit/react-native-webrtc";
const options = WebRTCModuleOptions.sharedInstance();
options.enableMultitaskingCameraAccess = true;
These steps should set you up nicely with CallKit and solid background support for your calls. If you run into any questions or need a hand with anything else, just let me know—I’m here to help!
Sources: docs/index.html | README.md | Documentation/iOSInstallation.md | Expo quickstart | LiveKit docsdamp-kite-83575
11/02/2025, 10:15 AMtall-airline-16756
11/02/2025, 10:16 AMInfo.plist file:
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
<string>audio</string>
</array>
• In Xcode, head over to Signing & Capabilities → Add Capability → Background Modes, and check:
◦ Voice over IP
◦ Audio, AirPlay, and Picture in Picture
2. Entitlements:
• com.apple.developer.pushkit.unrestricted-voip: You’ll need this if your app uses PushKit for VoIP push notifications to wake the app and report incoming calls through CallKit. It’s a good idea to start without it and add it only if necessary.
• com.apple.developer.usernotifications.communication: This one isn’t required for CallKit-based voice calling, so you can skip it.
3. Expo Configuration:
• To get things up and running smoothly, use a custom development build with `expo-dev-client`:
npx expo install expo-dev-client
• Also, add the LiveKit Expo plugin to your `app.json`:
{
"plugins": [
"livekit-react-native-expo-plugin"
]
}
4. Optional Changes in AppDelegate:
• If you’re targeting iOS 18 or newer and need background camera access, you can enable multitasking camera access in your AppDelegate.swift like this:
import { WebRTCModuleOptions } from "@livekit/react-native-webrtc";
let options = WebRTCModuleOptions.sharedInstance();
options.enableMultitaskingCameraAccess = true;
If you have any questions or need a hand with these steps, please don’t hesitate to reach out. I’m here to help you every step of the way!
Sources: Expo quickstart | LiveKit docs | README.md | callkit/README.mddamp-kite-83575
11/02/2025, 10:35 AMtall-airline-16756
11/02/2025, 10:36 AMApp.tsx for CallKit or background processing. These features are usually managed through native configurations and libraries like react-native-callkeep, which makes things a bit smoother.
Here are some key points to keep in mind:
• Use react-native-callkeep to integrate CallKit. The setup and initialization typically happen in native iOS files or a dedicated service file such as CallService.ios.ts.
• Make sure to enable Audio and VoIP background modes in your app’s capabilities through Xcode or Expo’s config plugin.
• Coordinate audio session events with WebRTC by calling RTCAudioSession.audioSessionDidActivate() and RTCAudioSession.audioSessionDidDeactivate() when CallKit events occur.
• To simplify native setup without ejecting, you can use the LiveKit Expo config plugin like this:
{
"plugins": [
"livekit-react-native-expo-plugin"
]
}
• Also, create a custom development build with expo-dev-client to include native modules by running:
npx expo install expo-dev-client
npx expo run:ios
If you have any questions or need a hand with these steps, please don’t hesitate to reach out—I’m here to help!
Sources: README.md | Expo quickstart | LiveKit docsdamp-kite-83575
11/02/2025, 1:23 PMnew NativeEventEmitter() requires a non-null argument., js engine: hermestall-airline-16756
11/02/2025, 1:24 PMAppDelegate.m or AppDelegate.swift, make sure to call the setup method before any other React Native initialization:
// Objective-C (AppDelegate.m)
#import "LivekitReactNative.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[LivekitReactNative setup];
// Other initialization
}
// Swift (AppDelegate.swift)
import livekit_react_native
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LivekitReactNative.setup()
// Other initialization
}
2. Verify Installation:
• Let's double-check that all dependencies are installed correctly:
npm install @livekit/react-native @livekit/react-native-webrtc livekit-client
cd ios && pod install
3. Check Native Module Availability:
• You can log the native modules to make sure they're properly registered:
import { NativeModules } from "react-native";
console.log("LiveKitModule:", NativeModules.LivekitReactNativeModule);
console.log("WebRTCModule:", NativeModules.WebRTCModule);
4. Clean and Rebuild:
• Sometimes a clean build helps. Try cleaning the iOS build and reinstalling dependencies:
cd ios
rm -rf build/ Pods/ Podfile.lock
pod install
npx react-native run-ios
5. Register WebRTC Globals:
• Make sure registerGlobals() is called in your index.js file:
import { registerGlobals } from "@livekit/react-native";
registerGlobals();
Give these steps a try, and hopefully, this will resolve the issue for you. If you run into any more trouble or have questions, please don't hesitate to reach out—I’m here to help!
Sources: android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java | ios/Podfile | React Native SDK | livekit/livekit_composite | DeepWiki | src/hooks/useMultibandTrackVolume.tsdamp-kite-83575
11/02/2025, 1:29 PMtall-airline-16756
11/02/2025, 1:29 PMForegroundServiceModule. While iOS handles this a bit differently using background modes and CallKit, I’m here to guide you through the setup step-by-step:
1. Enable Background Modes:
• Open Xcode, select your app target → Signing & Capabilities → Add Capability → Background Modes.
• Make sure to enable:
◦ Audio, AirPlay, and Picture in Picture
◦ Voice over IP (VoIP)
2. Use CallKit for Background Persistence:
import RNCallKeep from "react-native-callkeep";
import { RTCAudioSession } from "@livekit/react-native-webrtc";
export async function startCallService() {
RNCallKeep.startCall("uuid", "1234", "Caller");
RNCallKeep.reportConnectedOutgoingCallWithUUID("uuid");
}
export function setupCallService() {
const options = {
ios: {
appName: "LiveKitReactNative",
audioSession: {
category: "playAndRecord",
mode: "videoChat",
options: ["allowBluetooth", "allowAirPlay", "defaultToSpeaker"],
},
},
};
RNCallKeep.setSettings(options);
}
3. Use NativeEventEmitter for Events:
import { NativeEventEmitter } from "react-native";
import LiveKitModule from "../LKNativeModule";
const nativeEmitter = new NativeEventEmitter(LiveKitModule);
nativeEmitter.addListener("LK_AUDIO_DATA", (data) => {
console.log("Received audio data:", data);
});
Following these steps will help keep your app running smoothly in the background on iOS and handle events properly. If you run into any questions or need a hand with anything else, please don’t hesitate to reach out—I’m here to help!
Sources: docs/index.htmldamp-kite-83575
11/02/2025, 1:52 PMnew NativeEventEmitter() requires a non-null argument., js engine: hermestall-airline-16756
11/02/2025, 1:52 PMNativeEventEmitter is null or undefined. Don’t worry, I’m here to help you work through this on iOS. Let’s go through some steps together:
1. Ensure Proper Setup in AppDelegate:
• In your AppDelegate.m or AppDelegate.swift, make sure to call the setup method before any React Native initialization:
// Objective-C (AppDelegate.m)
#import "LivekitReactNative.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[LivekitReactNative setup];
// Other initialization
}
// Swift (AppDelegate.swift)
import livekit_react_native
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LivekitReactNative.setup()
// Other initialization
}
2. Verify Installation:
• Let’s double-check that all dependencies are installed and properly linked:
npm install @livekit/react-native @livekit/react-native-webrtc livekit-client
cd ios && pod install
3. Check Native Module Availability:
• It’s helpful to log the native modules to confirm they’re registered correctly:
import { NativeModules } from "react-native";
console.log("LiveKitModule:", NativeModules.LivekitReactNativeModule);
console.log("WebRTCModule:", NativeModules.WebRTCModule);
4. Clean and Rebuild:
• Sometimes a fresh build can clear up issues. Try cleaning the iOS build and reinstalling dependencies:
cd ios
rm -rf build/ Pods/ Podfile.lock
pod install
npx react-native run-ios
5. Ensure Proper Event Emitter Usage:
• Make sure you’re using NativeEventEmitter with a valid native module like this:
import { NativeEventEmitter } from "react-native";
import LiveKitModule from "../LKNativeModule";
const nativeEmitter = new NativeEventEmitter(LiveKitModule);
nativeEmitter.addListener("LK_AUDIO_DATA", (data) => {
console.log("Received audio data:", data);
});
I hope these steps help you get things running smoothly! If you run into any more issues or have questions, please don’t hesitate to reach out. I’m here to support you every step of the way!
Sources: README.md | examples/GumTestApp/ios/Podfile | React Native SDK | livekit/livekit_composite | DeepWiki | [Flutter iOS] SoundWaveformWidget / AudioVisualizerWidget Not Working (Miss...tall-airline-16756
11/02/2025, 3:09 PMnpx expo install livekit-client @livekit/react-native @livekit/react-native-webrtc @livekit/react-native-expo-plugin @config-plugins/react-native-webrtc
• Then, add these plugins to your app.json file:
{
"expo": {
"plugins": [
"@livekit/react-native-expo-plugin",
"@config-plugins/react-native-webrtc"
]
}
}
• After that, rebuild your app using these commands:
npx expo prebuild --clean
npx expo run:ios
2. Manual Setup (if you prefer not to use the plugin):
• Make sure to import LiveKit in your AppDelegate.swift like this:
import livekit_react_native
• And don’t forget to call LivekitReactNative.setup() inside `application(_didFinishLaunchingWithOptions)`:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LivekitReactNative.setup()
return true
}
3. Verify Installation:
• Double-check that all dependencies are installed and linked by running:
cd ios && pod install
• Then, rebuild your app to make sure everything is applied correctly.
4. Debugging Tips:
• Make sure you’re using a development build and not Expo Go.
• Confirm that the plugin is modifying native files during the build process.
• If things still seem off, try running npx expo prebuild --clean to regenerate native code.
If you run into any trouble or have questions along the way, please don’t hesitate to reach out—I’m here to help you!
Sources: docs/index.html | README.md | React Native quickstart | LiveKit docsdamp-kite-83575
11/02/2025, 3:13 PMtall-airline-16756
11/02/2025, 3:14 PMapp.json (like the LiveKit Expo plugin).
• Update native files such as AppDelegate.swift or Info.plist.
• Install new native dependencies (for example, @livekit/react-native).
To make sure everything is set up correctly, you can run these commands:
npx expo prebuild --clean
npx expo run:ios
This process will apply all your native changes and include them in your build. If you have any questions or need a hand with this, just let me know—I’m here to help!damp-kite-83575
11/02/2025, 3:51 PMnew NativeEventEmitter() requires a non-null argument., js engine: hermes whereas in android it's finetall-airline-16756
11/02/2025, 3:51 PMdamp-kite-83575
11/03/2025, 8:20 AM