-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
Description
Issue
Every time I open my app from notification press getInitialNotification returns null in Android. I am using @react-native-firebase/messaging without expo-notification module. I am receiving notification from a topic instead of the device token. It is working fine in expo IOS and react native cli project but not working in expo android.
Code
:
private setupNotificationOpenedHandler(
onNotificationOpenFromBackground: (
data: FirebaseMessagingTypes.RemoteMessage
) => void
): void {
// Handle notification opened when app is in background
onNotificationOpenedApp(this.messaging, (remoteMessage) => {
console.log(
"Notification caused app to open from background state:",
remoteMessage
);
this.handleNotificationOpened(remoteMessage);
});
// Handle notification opened when app is completely closed
getInitialNotification(this.messaging).then((remoteMessage) => {
console.log("opened for BG", remoteMessage);
if (remoteMessage) {
console.log(
"Notification caused app to open from quit state:",
remoteMessage
);
onNotificationOpenFromBackground(remoteMessage);
}
});
}
package.json
:
"dependencies": {
"@expo/vector-icons": "^14.0.2",
"@notifee/react-native": "^9.1.8",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/datetimepicker": "8.2.0",
"@react-native-firebase/app": "^23.0.0",
"@react-native-firebase/auth": "^23.0.0",
"@react-native-firebase/messaging": "^23.0.0",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/drawer": "^7.3.11",
"@react-navigation/native": "^7.1.9",
"@reduxjs/toolkit": "^2.7.0",
"expo": "~52.0.46",
"expo-blur": "~14.0.3",
"expo-build-properties": "~0.13.3",
"expo-constants": "~17.0.8",
"expo-dev-client": "~5.0.20",
"expo-font": "~13.0.4",
"expo-haptics": "~14.0.1",
"expo-image": "~2.0.7",
"expo-image-picker": "~16.0.6",
"expo-linking": "~7.0.5",
"expo-router": "~4.0.20",
"expo-splash-screen": "~0.29.24",
"expo-status-bar": "~2.0.1",
"expo-symbols": "~0.2.2",
"expo-system-ui": "~4.0.9",
"expo-updates": "~0.27.4",
"expo-web-browser": "~14.0.2",
"firebase": "^11.6.1",
"formik": "^2.4.6",
"moment": "^2.30.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.9",
"react-native-calendars": "^1.1312.0",
"react-native-draggable-flatlist": "^4.0.3",
"react-native-gesture-handler": "~2.20.2",
"react-native-paper": "^5.14.0",
"react-native-paper-dates": "^0.22.47",
"react-native-reanimated": "~3.16.1",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
"react-native-web": "~0.19.13",
"react-native-webview": "13.12.5",
"react-native-wheel-color-picker": "^1.3.1",
"react-redux": "^9.2.0",
"redux-persist": "^6.0.0",
"spacetime": "^7.10.0",
"yup": "^1.6.1"
}