Hi @evollu, you commented a while back about merging react-native-fcm and react-native-firebase's messaging and notifications functionality.
I'm not sure if you've seen, but we recently released v4.0.0 which overhauled messaging and notifications to address a large number of the issues that existed in our previous implementation.
This release covers the complete iOS and Android messaging / notifications API, has full documentation and is well tested.
I was wondering how you'd feel about starting to point people over to react-native-firebase
to start consolidating the two libraries and save us all from duplicating work?
Hi @chrisbianca
I'm willing to merge two libraries and I like your rich documentation.
I started react-native-fcm just like what you guys did: bridging the callbacks. However Firebase SDK has very limited features especially for Android. So people start needing banner, sound, large pictures, action buttons, recurring notification, and etc. So react-native-fcm now is a combination of Firebase SDK bridge and a local notification library. But I don't see any extra notification features in your documentation.
Is it on your road map?
Shall we migrate both?
Or shall we find a way that let react-native-firebase
handle everything Firebase and react-native-fcm
becoming a local notification library?
That's great @evollu
As you found, it's very hard to separate FCM and notifications, so we have implemented support for local notifications as part of v4 as well. What we have done though, is make a clean divide between data-only FCM messages and notification messages, as explained here: https://rnfirebase.io/docs/v4.0.x/messaging/introduction
You can find the documentation for notifications here:
Intro: https://rnfirebase.io/docs/v4.0.x/notifications/introduction
Receiving notifications: https://rnfirebase.io/docs/v4.0.x/notifications/receiving-notifications
Displaying notifications: https://rnfirebase.io/docs/v4.0.x/notifications/displaying-notifications
Scheduling notifications: https://rnfirebase.io/docs/v4.0.x/notifications/scheduling-notifications
Android notification channels: https://rnfirebase.io/docs/v4.0.x/notifications/android-channels
Complete reference docs: https://rnfirebase.io/docs/v4.0.x/notifications/reference/Notifications
We've tried to cover as much of the iOS and Android Notifications API as possible. The only outstanding area is iOS categories, which is coded but still needs testing to confirm it's working correctly.
Let me know what you think of the above.
Looks great. I think we can merge.
It is missing recurring notification but I can contribute to it.
Let me try it out over the week.
Just curious, are you guys a company backing this repo?
@evollu I've added the schedule documentation: https://rnfirebase.io/docs/v4.0.x/notifications/reference/Schedule
Have you had a chance to look through the library anymore?
I will try during weekend.
I tried local notification
questions:
RNFirebaseBackgroundMessage
headless task doesn't seem to be triggered when android app is killed@evollu Sorry for the delay, I've been away the last week.
NotificationOpen
class: https://rnfirebase.io/docs/v4.0.x/notifications/reference/NotificationOpen along with text from any remote inputscomponentDidMount
question on answer 4: componentDidMount doesn't get called when app is not running (say after system reboot).
This may be related to: https://github.com/invertase/react-native-firebase/issues/971 which I'm looking at this week
I'm having https://github.com/evollu/react-native-fcm/tree/firebase/Examples/firebase-migration to test all functions I'm interested in. but I can't get my headless listener working. Can you take a look and see what's wrong?
UPDATE:
I see crash log when trying to send a remote data message to android when app is killed (sending when app is in the background works fine).?
04-27 14:54:54.829 4619-4619/com.google.firebase.quickstart.fcm E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.firebase.quickstart.fcm, PID: 4619
java.lang.ExceptionInInitializerError
at c
at io.invertase.firebase.messaging.MessagingSerializer.parseRemoteMessage(MessagingSerializer.java:12)
at io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService.getTaskConfig(RNFirebaseBackgroundMessagingService.java:20)
at com.facebook.react.HeadlessJsTaskService.onStartCommand(HeadlessJsTaskService.java:51)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3539)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
My payload
{"to":"token",
"content_available":true,
"data": {
"title": "title2",
"body": "body2",
"now": "12123123"
},
"priority": "high"
}
I am getting same error as @evollu. Notifications work fine when app is in foreground or background. When app is closed I get the same log message along with a notification saying my app has crashed. This was working a few days ago, not sure what changed in my app.
@aminosman @evollu which version of React Native are you running? This error is coming from Arguments.createMap()
rather than anything from the RNFirebase code.
You're missing this section from your MainApplication.java
:
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
@chrisbianca That worked! Can you point me to where you found this as I would like to know I am missing this. Thanks!
A combination of a couple of old React Native issues:
Is this a project that you've had for a while? It might be that this line got added as part of a more recent update which was missed whilst updating to a newer version of React Native?
Yes this is an older project (running latest RN) and it looks like thats what happened. I see others in the same boat. You are awesome! Thanks.
Thanks for confirming! I'm glad it's that and not a bug with a later version of React Native (which wouldn't be unheard of!!!)
I'll get a note added to the docs...
Update: Added a note to the docs: https://rnfirebase.io/docs/v4.0.x/messaging/receiving-messages#4)-Check-%3Ccode%3EMainApplication.java%3C/code%3E
@evollu has that resolved your issue?
@chrisbianca yes problem solved. I'm using RN 0.48 btw
@evollu great, glad that鈥檚 now resolved.
Is there anything else that concerns you about messaging and notifications in react-native-firebase?
If not, what鈥檚 the best way to move this forward? I notice you鈥檝e already put a note on your repo which is great!
iOS actions and iOS handler when app is not running?
I will keep maintain the repo for existing users (bug fixes etc). But I will update the note to ask new users to check out your repo.
Does that sound good?
Yep, both WIP and should be done in the next week or so.
That sounds like a good plan to me, thank you!
FYI - I noticed you have a note/PR about Android 26 Channel support on your repo. This is already supported in react-native-firebase
.
By doing react-native-firebase linking is affecting my FCM callbacks in iOS ... why? can anyone help me out?
@chrisbianca
Any news on iOS actions?
Most helpful comment
Looks great. I think we can merge.
It is missing recurring notification but I can contribute to it.
Let me try it out over the week.
Just curious, are you guys a company backing this repo?