-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
🔥onMessage is Not Called when App is Opened by clicking the notification #3032
Comments
There are many similar issues open right now. A few contain workarounds. What have you tried? |
What do you mean by workaround? Or is this kind of feature not possible with v6 of react-native-firebase? |
Oh! sorry about that. I was crossing messaging and notifications in my mind. RNFBv6 does not do notifications. |
Ok, just to make it clear.
but i can't:
|
Basically yes but I'll draw a finer line with regard to payload. RNFBv6, use data-only messages, no notification payload. Use RNFB to catch the messages. Integrate with react-native-push-notifications to access local device APIs to do the notification bit |
Ok, Is there a reason why RNFBv6 is not getting the information about the notification which opens the App? |
RNFBv6 does not do anything local notification related. Local notification APIs are actually unrelated to firebase APIs - messaging is a firebase service but notifications aren't an in practice for this library it was unsustainable to attempt to cover the APIs. If you think if's more complicated to use multiple frameworks you can imagine the complication of actually attempting to author one of the frameworks. You can read all about it in the pinned issue on this repo. I was under the impression data only worked in all cases, it was just difficult to set up. |
Ok i will try to combine |
Hey, PreambleThis is not a complete guide for installing RNFBv6 Messaging and RNPN (https://github.com/zo0r/react-native-push-notification), it just covers my problems after trying to use RNFBv6 Messaging. In the following RNFBv6 Messaging is just called RNFBv6. WordingPushNotifications -- remote Message from FCM with AimFirst things first. What am I trying to achieve? RNFBv6At first installing RNFBv6 worked quite well and receiving Token worked. Handling PushNotifications was not really working. Now my way with RNPN: Androidupdate
|
Great write-up @KTDevelopment! - messaging and notifications are indeed quite difficult to get working right now and they are also one of the most important things everyone wants. We'll continue working to make them simply work (like the issues you mentioned) but for documentation I must admit the community is almost the best source of updates since people come to the project with fresh eyes. If there is anything you think is missing every documentation page has an edit button on the top right and github has a really streamlined/easy pull-request flow for documentation pull requests |
@KTDevelopment Thank you for this write-up! I was trying to implement this for a long time. But now I'm going to follow your write up and try it again. |
Hi, Thx @KTDevelopment for your post. I tried this and everything working excepted that the OnNotification function is not called when App is in foreground, it works only when app is in background, and I don't understand why. Is it working for you ? |
I find a solution if someone want to know, I use popInitialNotification from react-native-push-notification and it works with Foreground and background. Thx for this topic it really help me. |
Hello 👋, to help manage issues we automatically close stale issues.
|
Same problem here, onMessage is not triggered when the app is in the background. @KTDevelopment solution works, but it should just work with FCM. If you send test message from the firebase FCM console, those should always trigger the onMessage handler, but this is not the case. Tested on 6.3.2 |
Guys, I'm a total newbie and most of this is way over my head. How am I supposed to integrate FCM with react-native-push-notification? I've followed the instructions for both - PushNotificationIOS is placed in AppDelegate.m, but what about all the react-native code? How do I get a FCM token? Does that have anything to do with the device token for APNS (triggered by PushNotification.configure)? I'd love to see a fully working example in javascript. I was using react-native-permissions to get around the getToken bug, but now that I've installed RNPN, it's back again. I'm just lost. At this point I'm probably going to go back to 5.x, but would really appreciate clear documentation on how to integrate. @mikehardy You say there are certain types of messages that RNFB v6 will still receive? onMessage never fires when push notifications are sent to the device. When the app is in the background, it shows on the screen, but tapping onto the notification triggers no code once in the app, nor does anything happen if the app is in the foreground. I'm absolutely clueless on how to get RNFB onMessage to work. The Invertase documentation suggests it should work pretty easily. I'm unfortunately a (frustrated) newbie, so most of what I've spent several hours reading through on github/stackoverflow isn't helpful. I should also clarify that I'm trying to send messages from the FCM dashboard. Something on the old RNFB site suggests that the console can only send notifications, which is handled by a separate notification library and that the data-only notifications that onMessage receives only data-only messages, which cannot be sent by the firebase console anyway, only through cloud functions/etc. So this adds confusion to the mix. |
@tmaly1980 it is all pretty confusing to be honest. People using messaging/notifications in the same context don't help, especially when they're totally separate things :) The below linked PR should help sort handling notifications from the console... I'll link it when it's live. |
This has been fixed in #3339 please try out the RC - 6.4.0-rc4. |
Issue
Describe your issue here
I managed to get messaging working when the App is in foreground, so registration for token and receiving works.
But there is a problem when opening the App from the notification.
The onMessage callback is not called if the App is opened that way.
What am I missing out, how can i achieve that i have a specific indicator if my app is opened from a Notification or even better how can i access the notification of that my app was opened from.
Project Files
Javascript
Click To Expand
package.json
:# N/A
firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:AppDelegate.m
:Android
Click To Expand
Have you converted to AndroidX?
android/gradle.properties
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:android/app/build.gradle
:android/settings.gradle
:MainApplication.java
:AndroidManifest.xml
:Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:6.2.0
Firebase
module(s) you're using that has the issue:@react-native-firebase/messaging
@react-native-firebase/app
TypeScript
?Y
&3.7.3
The text was updated successfully, but these errors were encountered: