React-native-push-notification: android crash on notification open

Created on 24 Jul 2016  路  14Comments  路  Source: zo0r/react-native-push-notification

07-24 04:22:35.981 21951-21951/com.myapp.mobile.android E/AndroidRuntime: 
FATAL EXCEPTION: main
                                                                            Process: com.myapp.mobile.android, PID: 21951
                                                                            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 com.myapp.mobile.android.MainActivity.onNewIntent(MainActivity.java:26)
                                                                                at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1240)
                                                                                at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1252)
                                                                                at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:3425)
                                                                                at android.app.ActivityThread.performNewIntents(ActivityThread.java:3437)
                                                                                at android.app.ActivityThread.handleNewIntent(ActivityThread.java:3446)
                                                                                at android.app.ActivityThread.access$1900(ActivityThread.java:222)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1872)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:158)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

issue is starting in this lines

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        ((MainApplication) getApplication()).onNewIntent(intent);
    }

if I remove super.onNewIntent(intent); then notification opens without crash, but of course then some other packages doesn't work anymore (fbsdk for example)

Most helpful comment

@knowbody, @ivpusic is spot on. In my case it turns out I was using old versions of react-native-image-picker that didn't implement onNewIntent. I updated (or added the function to the module) and it worked.

Hope that helps !

All 14 comments

I also have this issue

Hey,

What version of RN are you using?
What version of Android SDK are you using?
What Android phone are you using?

RN 0.30, samsung galaxy s7, android 6.0.1

See #152 I believe there's a new onNewIntent method that breaks the way this works in 0.30

@ivpusic @peterpme @lauborges just released 2.0.2 (compatible with RN 0.30)

@ivpusic for the fbsdk part:
https://gist.github.com/satya164/bc9e6f16f2d86a622e82ea795cc8292b

tnx for update, but I am still getting crash when I open notification on android. Now with a little bit different stack trace

FATAL EXCEPTION: main
                                                                            Process: com.myapp.mobile.android, PID: 27147
                                                                            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:1240)
                                                                                at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1252)
                                                                                at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:3425)
                                                                                at android.app.ActivityThread.performNewIntents(ActivityThread.java:3437)
                                                                                at android.app.ActivityThread.handleNewIntent(ActivityThread.java:3446)
                                                                                at android.app.ActivityThread.access$1900(ActivityThread.java:222)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1872)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:158)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

second crash was coming from the other package, so after upgrade to 2.0.2 it works. Thanks a lot

hi I'm having the same issue:

Fatal Exception: 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:1211)
       at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1223)
       at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2493)

I'm on react-native-push-notification version 2.0.2 and RN 0.30

Can you tell me how onNewIntent method should look like and where should it be? in MainActivity or MainApplication?

Everything seems to work fine, the app crashes when I try to open the notification from notification center on Android.

@knowbody in 2.0.2 you don't need to implement the onNewIntent part anymore.

@zo0r but then why do I get the above error? did I miss something? any idea?

I had similar issue...problem was not with this package, but with one of other packages I was using...I suggest that you check sources of other native packages you are using, and check if they implement onNewIntent hook

@ivpusic the only module I can think of is fbsdk but I follow the newest docs and version from there, so not sure. If you have some time to help out with this, would appreciate the help

@knowbody, @ivpusic is spot on. In my case it turns out I was using old versions of react-native-image-picker that didn't implement onNewIntent. I updated (or added the function to the module) and it worked.

Hope that helps !

Thanks @RakanNimer I had the exact same problem

Was this page helpful?
0 / 5 - 0 ratings