react-native-firebase
react-native-firebase copied to clipboard
While app in foreground Notifications not receving
I'm using "react-native-notifications": "^4.1.2" to show push notifications with "@react-native-firebase/messaging": "^12.8.0" Able to receive messages when app is kill state, background state. Push messages not receiving when app is open state (foreground notifications.txt )
I have the same problem. This used to work but now it works only sometimes.
`import PushNotificationIos from '@react-native-community/push-notification-ios'; import messaging from '@react-native-firebase/messaging'; import { useEffect } from 'react'; import PushNotification from 'react-native-push-notification';
import { handleNotificationData } from '../Navigation';
const NotificationController = () => { PushNotification.configure({ onNotification: (notification) => { if (notification) { handleNotificationData(notification.data); } }, requestPermissions: false, });
useEffect(() => { const unsubscribe = messaging().onMessage(async (remoteMessage) => { PushNotificationIos.addNotificationRequest({ id: remoteMessage.messageId, body: remoteMessage.notification.body, title: remoteMessage.notification.title, userInfo: remoteMessage.data, }); });
return unsubscribe;
}, []);
return null; };
export default NotificationController; `
Same problem here, tried with v12.6.0 and then upgraded to v12.8.0, iOS only.
I noticed two things though:
- While no javascript callback gets called, I do see some logging on Xcode and seeing the message being received by the phone,
- It does work if you put the handler straight into index.js, before bootstrapping the app (which is not very useful).
So this seems to be a very strange issue as it only works on very specific conditions that don't make much sense.
any update ?
@juanstiza could you add some code please? And could you guys be more specific about what doesn't work ? The message is not received or the message is not shown?
Reminder, foreground messages are never shown : https://rnfirebase.io/messaging/usage#notifications
@ludovicjamet We currently stopped trying to handle these notifications for the time being, if we do, I'll see to create a reproducible repo.
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.