Closed connercms closed 6 years ago
for your first question. Can you add breakpoint at MessageService.java -> onMessageReceived
and see how many times it gets called? This function should be only called once.
second question: for android there will be such noise. filter it out by some type attribute.
onMessageReceived is called only once.
ok I find the issue. I assume 2nd notification is the one you want?
does 1st notification contain custom_notification
The second notification formatting seems strange. Everything in custom_notification is a string. Is it supposed to be this way? But yes, we would prefer the second notification as it has the data we are sending over
try master branch. it should only have the 2nd notif now. custom_notification is a string because firebase only supports 1 level deep object. it stringifies deeper object
That seems to be working. Only receiving the one notification now. However, when the app is not running and a notification comes in, and I press on the notification, FCM.getInitialNotification payload looks like first one mentioned above (without the data we send). Is there a way to retrieve this data?
that is expected. because custom_notification is actually building a local notification. you can have your properties inside custom_notification obj.
Probably you have another third part do implementing receive notification event
I have the same problem. MessageService.java -> onMessageReceived is triggered multiple times. How to solve this?
@ram-vertace it is more likely configuration issue. e.g. you have registered event multiple times. closing this as original issue is inactive
Please check settings.gradle file
My issues:- I was calling this twice
include ':react-native-fcm'
project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android')
check this ones
@evollu We are using fcm-django library to construct a push notifications. The following is our code to generate our notif from the django app
And the code on our react-native side
First notification payload looks like
Second notification payload looks like
We are receiving notifications when app is in foreground, background, and killed, but FCM.on(FCMEvent.Notification) listener is called twice each time.
What version of RN and react-native-fcm are you running? RN: 0.46.2 RNFCM: 7.1.0 What device are you using? (e.g iOS9 emulator, Android 6 device)? Android LG V20 running Nougat (7.0) Is your app running in foreground, background or not running? Happens for each scenario
Also another issue we are running in to is the listener is triggered when the app is opened by pressing the app icon from the home screen of the device and opened_from_tray is always = 1, but docs say this should only happen when pressing banner?