OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
251 stars 199 forks source link

[Bug]: Google Play Console is Reporting Crashes and ANR errors and Siting OneSignal in the Trace #1022

Open selected-pixel-jameson opened 1 month ago

selected-pixel-jameson commented 1 month ago

What happened?

When I submit my build to Google Play Console it does a pre-launch report. The pre-launch report is siting Crashes which include a reference to OneSignal. This is the only 3rd party library listed on the stack trace.

Steps to reproduce?

Implement the OneSignal Cordova Plugin in an Ionic Capacitor App. 
Build and Android App
Submit the App to the Google Play Console
Check the Pre-Launch Report

What did you expect to happen?

The app to not crash

OneSignal Cordova SDK version

5.2.1

Which platform(s) are affected?

Relevant log output

exception java.lang.RuntimeException: Unable to destroy activity {com.keycollectorcomics.keycollector/com.keycollectorcomics.keycollector.MainActivity}: java.lang.Exception: Must call 'initWithContext' before use
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5454)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5487)
  at android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:47)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2253)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7870)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by java.lang.Exception: Must call 'initWithContext' before use
  at com.onesignal.internal.OneSignalImp.getNotifications (OneSignalImp.kt:99)
  at com.onesignal.OneSignal.getNotifications (OneSignal.kt:62)
  at com.onesignal.cordova.OneSignalPush.onDestroy (OneSignalPush.java:703)
  at org.apache.cordova.PluginManager.onDestroy (PluginManager.java:326)
  at com.getcapacitor.cordova.MockCordovaWebViewImpl.handleDestroy (MockCordovaWebViewImpl.java:182)
  at com.getcapacitor.Bridge.onDestroy (Bridge.java:1354)
  at com.getcapacitor.BridgeActivity.onDestroy (BridgeActivity.java:126)
  at android.app.Activity.performDestroy (Activity.java:8339)
  at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1376)
  at androidx.test.runner.MonitoringInstrumentation.callActivityOnDestroy (MonitoringInstrumentation.java:1)
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5441)

Code of Conduct