react-native-fcm: Android crashes when receiving notification

I’m running into the following issue when using the latest react-native-fcm@1.0.16 and react-native@0.30

I have setup the package as outlined in the documentation with the only thing still not quite clear to me whether to add the public onNewIntent() method to MainActivity.java. i get the same crash whether i add it or not though so it does not seem to make a difference.

I thnk the docs are a bit unclear here since RN>0.29 apps now use MainApplication.java for additional activity methods as far as i can tell.

Either way, what happens is; while notifications are received fine on the device (tested on simulator) once a notification is received when the app is not in focus or started and you start the app it immediately crashes.

I get the following stack trace from Android Studio:

07-28 16:13:53.355 4733-4733/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.florinapp.florinapp.debug, PID: 4733
                                                 java.lang.AbstractMethodError: abstract method "void com.facebook.react.bridge.ActivityEventListener.onNewIntent(android.content.Intent)"
                                                     at com.facebook.react.bridge.ReactContext.onNewIntent(ReactContext.java:169)
                                                     at com.facebook.react.ReactInstanceManagerImpl.onNewIntent(ReactInstanceManagerImpl.java:483)
                                                     at com.facebook.react.ReactActivity.onNewIntent(ReactActivity.java:183)
                                                     at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1223)
                                                     at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1235)
                                                     at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2783)
                                                     at android.app.ActivityThread.performNewIntents(ActivityThread.java:2795)
                                                     at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2804)
                                                     at android.app.ActivityThread.-wrap15(ActivityThread.java)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1539)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:154)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 32 (15 by maintainers)

Most upvoted comments

it is image picker

yup that was it. thanks again!

@tijs this issue happen when some library adds listener to reactContext.addActivityEventListener(this); while not implementing overriding function for onNewIntent. the build succeed because in gradle it depends on lower react native version. search for addActivityEventListener and see what library has it but doesn’t implement onNewIntent

I sort of know why. will fix tomorrow