import messaging from "@react-native-firebase/messaging";
import {
isFirebaseStreamVideoMessage,
firebaseDataHandler,
} from "@stream-io/video-react-native-sdk";
messaging().setBackgroundMessageHandler(async (msg) => {
if (isFirebaseStreamVideoMessage(msg)) {
await firebaseDataHandler(msg.data);
} else {
// your other background notifications (if any)
}
});
1.3.0
The 1.3.0 version fixes an issue with push notifications, which includes breaking changes, so please review the migration guide before upgrading.
🔨 What changed?
Previously, the SDK set up the notification handlers automatically. But in Notifee, only one notification handler can be added per app. This meant that notifications other than those from Stream were not set up.
To address this issue, the SDK now supports adding notification handlers from your end instead of setting them up automatically.
🚨 Breaking Changes
- The following methods from
setPushConfig
have been deprecated and removed:navigateAcceptCall
navigateToIncomingCall
💡 How do you set up notification handlers?
To process the incoming push notifications quickly, the SDK provides utility functions you must add to your existing notification listeners. Below is an example snippet of how to add the Firebase background listener:
- The
isFirebaseStreamVideoMessage
method is used to check if this push message is a video related message. And only this needs to be processed by the SDK. - The
firebaseDataHandler
method is the callback to be invoked to process the message. This callback reads the message and uses the@notifee/react-native
library to display push notifications.
Check documentation for details
Please visit our relevant setup documentation, linked below, and look for the changes regarding notification handlers.
Additionally, the ringing setup documentation was updated with Play Store declaration requirements for the Foreground Service in Android. Please check that out as well.
🔍 Support
If you face trouble migrating the Push Notifications setup, please submit a ticket to us at support. We are always here to help out.