-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notification Event Callbacks are not Firing on iOS #561
Comments
My NotificationService code:
and my AppDelegate.m contains:
and
|
Did find a way to solve this issue? I was experiencing almost the same thing in iOS. But mine doesn't receive any notification at all. But on the Android side it works as expected. |
I am having the same issue |
@jwarrencedro still no solution from me :( I am able to actually receive notifications on iOS though. Its worth noting that Im using a firebase cloud messaging (fcm) token to send notifications to the device. You can also utilize the APNS token returned from react-native-notifications to send the notifications by manually converting it into an fcm token as outlined in this comment: #408 (comment) I have also tried using the curl method of sending a push notification directly via the APNS token (as outlined in this post: https://dev.to/jakubkoci/react-native-push-notifications-313i) to rule out firebase as the culprit of the event handlers not triggering. I am able to successfully receive push notifications via both methods, however none of the event handler callbacks are ever invoked. I've set a bunch of log statements in the native code itself and nothing seems to trigger there either. |
Yes, the same for me, I have tried manually with Firebase Cloud Messaging and I am getting the notification (Just when the app is on background, not on foreground). However as you mention none of the handling methods are executed. The same logic works perfectly with Android |
@AlexD10S let me know if you ever figure anything out. This is really frustrating and I don't understand the native iOS side well enough to even conceptually grasp what's missing. A lot of people report that the iOS notifications do work so I have been thinking about what kind of environment or configuration setting might be causing this difference in observed behavior. |
Bumping this so that the inactivity bot doesn't get any ideas 😅 I feel like this is a serious issue and is impacting the ability to use this library at all. Would love to hear even some quick thoughts from the maintainers about just generally what might be causing this. |
@AlexD10S So basically Im going to be using platform checks to instantiate Android event handlers using RNN, or ios event handlers using FCM. Its hacky, but thats react-native for you. |
Seeing same exact issue here, wanted to try out this library to use those callbacks but using same code as the docs they don't seem to work |
Experiencing the same issue as well here. Really want to avoid having to piece together th implementing with FCM since it works really well for Android. |
Same issue |
I know its poor form to reference another lib in the GH issues of another, but I just want to share what ended up working for me because I spent weeks dead in the water because of this problem. Here is my implementation that uses the FCM event handler (which is semi-undocumented, make sure you're on the latest version release candidate) or the RNN event handler based on the Platform:
And for the record I harbor no ill feelings toward any lib. React Native is such a complicated and community-driven ecosystem that anyone whose ever spent any time working on its open-source tooling deserves a medal and a cup of coffee :) |
I'm experiencing the exact same behavior as you described. I guess I'll go with your "fix" described for now. It might be worth noting that |
I'm having the same issue. |
@rynatk Thanks so much for finding a work around for this, really helped me a lot! As an addendum for anyone else finding this thread:
is the workaround for BACKGROUND notifications
is the workaround for FOREGROUND notifications |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This is certainly still an issue and should not be closed |
Me too. I can use only three event methods.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
go away stalebot |
I was experiencing this issue. And I found out the cause is from react-native-firebase/messaging. This issue was fixed at this commit invertase/react-native-firebase@b17df84 I also fixed the issue related to notification not called in foreground here. Please approve it invertase/react-native-firebase#4088 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I'm facing the same issue |
I was having similar issues and for some reason because I was using This caused the https://github.com/wix/react-native-notifications/blob/master/lib/src/adapters/NativeEventsReceiver.ts#L12 I think it might be worth checking into if people are running into this issue, because it seems like it can happen quite often in the wild. |
I have same issue, not any event get trigger, tested in real devices as well |
I had this issue after migrating from One thing I didn't do, that brought me to this issue, was remove the UNUserNotificationCenter delegate that I added to my AppDelegate.h file as part of Removing that allowed this library to start firing callbacks in IOS. So if you're in a similar situation as me, be sure to remove that delegate. |
Same problem on iOS and mine
Does not work |
Do not forget to Enable the Remote Notifications Capability as it mentioned in the handling notifications section |
@anisimov74 I think the problem is that everything works except for the three events noted in the comment above you. I can receive notifications, just in the background. useEffect(() => {
const sub = Notifications.events().registerNotificationReceivedForeground(
(notification: Notification, completion) => {
console.log(
`Notification received in foreground: ${notification.title} : ${notification.body}`,
);
completion({alert: true, sound: false, badge: false});
},
);
return () => {
sub.remove();
};
}, []); For example, the above never fires, I cannot see that |
I was able to get this resolved. It appears that another dependency was hijacking the notification center delegate. I found this by searching for In my case the offending dependency was: https://github.com/Countly/countly-sdk-ios/blob/9addfda94f6c2eddcaf2bb8df572cc7745696513/CountlyPushNotifications.m#L70-L71 Once that was dealt with, Note that I wasn't even using the Countly push notification functionality, but it seems to be enabled by default without warning. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
STOP |
I want to try and figure it out, the solutions people found here are (big applause to all of them):
Please, anyone who is facing this issue, try those solutions and if it doesn't work write it here and we will continue investigating |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue has been closed for inactivity. |
registerNotificationOpened
|
I fixed by adding these lines into
|
In my case I forgot to link ios properly in AppDelegate and staff: https://wix.github.io/react-native-notifications/docs/getting-started/#ios |
I have experienced same problems as you guys , and here is the solution, first the document is not updated, but the example.js in the project is. if you compare the quick start guide with the code here then you see this is missing from the quick start guide
I can log the incoming message from firebase but I can't really use |
@weihangChen , PR will be welcomed 🍦 |
@DanielEliraz , PR created |
My issue was that I had a custom implementation for
in my AppDelegate.m file. If I don't implement this delegate method, then I can get the callbacks working as expected. This is because my implementation seems to be hijacking the implementation of this method by the library (it is supposed to be hitting this code
|
@iledzka did it work for you? |
@iledzka I have a custom implementation too, but it has an issue. Could you please tell me if you have patched the RNNotificationCenterListener.m? |
Thanks for picking up the task of being the only free and maintained PN library for react-native 🙏
react-native: 61.0
react-native-notifications: 3.1.4
I have followed the installation instructions exactly as outlined, and have picked up a few additional snippets from other github issues that have helped me get to a perfectly functioning Android implementation for foreground, background (warm) and background (cold) notifications.
Im having some issues on iOS though, namely none of the native event callbacks are firing:
registerNotificationOpened
registerNotificationReceivedBackground
registerNotificationReceivedForeground
I am receiving push notifications on iOS and when I press the notification banner, none of those callbacks are triggered.
It may be worth noting that
getInitialNotification
is working on iOS.I've searched every issue and am at a loss. Any ideas what I may have improperly configured, or is anyone else experiencing this?
I'm using firebase to send the actual remote notifications.
The text was updated successfully, but these errors were encountered: