Native crash when receiving some kinds of FCM messages. The issue:
The app crashes/closes with the following error (seen on Android Studio):
--------- beginning of crash
09-25 07:20:55.555 6609-6979/com.XXX E/AndroidRuntime: FATAL EXCEPTION: Firebase-RNFirebaseMessagingService
Process: com.XXX, PID: 6609
java.lang.ClassCastException: com.XXX.MainApplication cannot be cast to com.facebook.react.bridge.ReactContext
at io.invertase.firebase.Utils.isAppInForeground(Utils.java:155)
at io.invertase.firebase.messaging.RNFirebaseMessagingService.onMessageReceived(RNFirebaseMessagingService.java:34)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:60)
at com.google.firebase.iid.zzg.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
09-25 07:20:55.561 6609-6979/com.XXX I/Process: Sending signal. PID: 6609 SIG: 9
(I was trying this setup to create "custom notifications" from my own JS code like the docs explain - but will revert to notification messages which were properly working - thanks for the project!)
Android
Ubuntu 18.04
Android Studio 3.1.4, Android SDK 26
React Native version:"0.56.0",
React Native Firebase Version:"react-native-firebase": "^5.0.0-rc4",
Firebase Module:messaging
typescript?no
Thanks for the report - have just pushed a fix for this in https://github.com/invertase/react-native-firebase/commit/fb6153db94a9bf70fbfd347e41d8006042e56ae2
This will be available in the v5 release later today. 馃憤
Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:
React Native Firebase and Invertase on Twitter
Most helpful comment
Thanks for the report - have just pushed a fix for this in https://github.com/invertase/react-native-firebase/commit/fb6153db94a9bf70fbfd347e41d8006042e56ae2
This will be available in the v5 release later today. 馃憤
Loving
react-native-firebaseand the support we provide? Please consider supporting us with any of the below:React Native FirebaseandInvertaseon Twitter