Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: getInAppMessages causing initWithContext exception #1628

Closed
2 of 3 tasks
virenradadiya opened this issue Jan 10, 2024 · 2 comments
Closed
2 of 3 tasks

[Bug]: getInAppMessages causing initWithContext exception #1628

virenradadiya opened this issue Jan 10, 2024 · 2 comments

Comments

@virenradadiya
Copy link

virenradadiya commented Jan 10, 2024

What happened?

I have integrated in-app messaging into my application using OneSignal. I am having this kind of crash on the play console.

Type java.lang.RuntimeException

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5294)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5323)
  at android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:44)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:192)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:113)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2228)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:241)
  at android.app.ActivityThread.main (ActivityThread.java:7888)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:512)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:998)
Caused by java.lang.Exception: Must call 'initWithContext' before use
  at com.onesignal.internal.OneSignalImp.getInAppMessages
  at com.onesignal.OneSignal.getInAppMessages (OneSignal.java)
  at com.onesignal.rnonesignalandroid.RNOneSignal.removeHandlers (RNOneSignal.java)
  at com.onesignal.rnonesignalandroid.RNOneSignal.onHostDestroy (RNOneSignal.java)
  at com.facebook.react.bridge.ReactContext.onHostDestroy
  at com.facebook.react.ReactInstanceManager.moveToBeforeCreateLifecycleState
  at com.facebook.react.ReactInstanceManager.onHostDestroy
  at com.facebook.react.ReactInstanceManager.onHostDestroy
  at com.facebook.react.ReactDelegate.onHostDestroy
  at com.facebook.react.ReactActivityDelegate.onDestroy
  at com.facebook.react.ReactActivity.onDestroy
  at android.app.Activity.performDestroy (Activity.java:8245)
  at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1355)
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5279)

Steps to reproduce?

I am not able to re-produce and I am not getting any crashes on my real device.

What did you expect to happen?

I have integrated in-app messaging into my application using OneSignal.

React Native OneSignal SDK version

5.0.3

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

@virenradadiya thank you for reaching out! This looks like you may be trying to call some InAppMessage namespace methods before fully initializing OneSignal. Could you please provide some additional information about how and when you're calling these methods? Thanks!

@nan-li nan-li changed the title [Bug]: I am having crash on playconsole. [Bug]: getInAppMessages causing initWithContext exception Jan 17, 2024
@jennantilla
Copy link
Contributor

Closing due to no response. @virenradadiya please let me know if you are still having issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants