React-native-firebase: Native crash when receiving some kinds of FCM messages (wix v2 app)

Created on 25 Sep 2018  路  1Comment  路  Source: invertase/react-native-firebase

Issue

Native crash when receiving some kinds of FCM messages. The issue:

  • My app is using Wix navigation library (Wix v2 Application main class seems to be this
  • App is on the foreground
  • Receiving a non-notification FCM message (e.g. with data key) and...

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!)

Environment

  1. Application Target Platform:

Android

  1. Development Operating System:

Ubuntu 18.04

  1. Build Tools:

Android Studio 3.1.4, Android SDK 26

  1. React Native version:

"0.56.0",

  1. React Native Firebase Version:

"react-native-firebase": "^5.0.0-rc4",

  1. Firebase Module:

messaging

  1. Are you using typescript?

no


Utils Bug Android

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-firebase and the support we provide? Please consider supporting us with any of the below:

>All comments

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:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

santoshachari picture santoshachari  路  50Comments

adirzoari picture adirzoari  路  50Comments

bitfabrikken picture bitfabrikken  路  52Comments

GH974 picture GH974  路  47Comments

gilbert picture gilbert  路  65Comments