App crashes after click in the received push notifications

Hello guys,

Some months ago I opened this topic about the issue involving the push notifications’ icon: Another topic about icons

Today I guess I found another error and I didn’t find an answer in the forum about this.
The push notifications is working very well. The messages are reaching the target devices and it is showed exactly as the expected, however when this notitication is clicked, the app doesn’t open when it is background state and an Android alert appears informing the app has stopped.

Something similar happens when the app is in the foreground. When the notification is clicked, the app is closed and the same alert described above appears too.

Thanks

Hi @Roberio_Lima

Can you please provide the stacktrace with the error? It will help us to reproduce this issue.

Best Regards,
Maksym

Hi @Maksym_Khobotin,

I’m developing with React-Native, I’ve tried here some things like this command inside the android folder: gradlew installDebug --stacktrace, but they didn’t show anything different than what I described in the message above.

Do you have any suggestion?

And what behaviour do you observe after running gradlew installDebug --stacktrace @Roberio_Lima ?
We need some details to help you. Without error message or reproducing steps we are powerless.

Best Regards,
Maksym

The behaviour observed was the same I described in the first message, @Maksym_Khobotin . When the notification is clicked the app chashes and the system shows an alert with something with the app has stopped.

I tested in 3 devices. Two with Android 6.0 and the other one with Android 7. In the Android 7 the app opened normally after I clicked the notification, different from the others two that stopped.

So I thought about to do a combo running the app with the usual commands and opening the Android Studio to check if the error would appear in the Logcat and this error message was showed:

java.lang.RuntimeException: Unable to start receiver com.reactlibrary.RNBackendlessPushNotificationActionReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2928)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:677)
at android.app.ContextImpl.startActivity(ContextImpl.java:664)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:341)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:341)
at com.reactlibrary.RNBackendlessPushNotificationActionReceiver.onReceive(RNBackendlessPushNotificationActionReceiver.java:40)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2921)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

And one more information considering that some parts of the code maybe can be reviewed, recently always the app starts to run the following message appears:

warn The following packages use deprecated “rnpm” config that will stop working from next release:

Hi @Roberio_Lima

We are studing your problem and will answer you asap!

Regards,
Marina

Hi @Roberio_Lima

We’ve fixed the issue and published a new version 0.1.4.

Please run

npm i backendless-react-native -S

to update Backendless SDK and let us know if everything works fine.

Best Regards,
Maksym

Thanks @Maksym_Khobotin, it worked very well now. It was necessary to fix the thing with the smallIcon function, but this a small issue.

Regards,
Robério