Skip to main content
Version: Next

Background calls

Both Android and iOS support calls running in the background, but they use different approaches:

  • Android: Uses foreground services to keep the app active in the background
  • iOS: Uses CallKit integration to maintain VoIP calls in the background

Below is configuration required to make it work:

You need to modify app.json file and add our plugin:

{ "expo": { ... "plugins": { ... [ "@fishjam-cloud/react-native-client", { "android": { "enableForegroundService": true }, "ios": { "enableVoIPBackgroundMode": true } } ], ... } } }

Usage

You can use useForegroundService hook to handle how foreground service behaves on Android.

Permissions

If you want to use enableCamera or enableMicrophone, user must first grant permission for this resource. useForegroundService will check if permission is granted and only then allow to start a service.

import { useForegroundService, useCamera, useMicrophone, } from "@fishjam-cloud/react-native-client"; const { isCameraOn } = useCamera(); const { isMicrophoneOn } = useMicrophone(); useForegroundService({ channelId: "io.fishjam.example.fishjamchat.foregroundservice.channel", channelName: "Fishjam Chat Notifications", notificationTitle: "Your video call is ongoing", notificationContent: "Tap to return to the call.", enableCamera: isCameraOn, enableMicrophone: isMicrophoneOn, });