react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

While app in foreground Notifications not receving

Open gomagomathy opened this issue 2 years ago • 6 comments

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 )

gomagomathy avatar Sep 20 '21 11:09 gomagomathy

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; `

ziga-hvalec avatar Oct 01 '21 09:10 ziga-hvalec

Same problem here, tried with v12.6.0 and then upgraded to v12.8.0, iOS only.

I noticed two things though:

  1. While no javascript callback gets called, I do see some logging on Xcode and seeing the message being received by the phone,
  2. 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.

juanstiza avatar Oct 01 '21 17:10 juanstiza

any update ?

akimabs avatar Oct 28 '21 10:10 akimabs

@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 avatar Oct 28 '21 13:10 ludovicjamet

@ludovicjamet We currently stopped trying to handle these notifications for the time being, if we do, I'll see to create a reproducible repo.

juanstiza avatar Nov 02 '21 11:11 juanstiza

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.

stale[bot] avatar Apr 18 '22 18:04 stale[bot]