Skip to main content

Streaming from background

On Android, it is possible to continue streaming when app is in background. Unfortunately this functionality is not available on iOS (due to Apple limitations)

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
}
}
],
...
}
}
}

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.

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,
});