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]: NPE in SessionService.getScheduleBackgroundRunIn #2205

Open
1 task done
maximkir-fl opened this issue Oct 15, 2024 · 1 comment
Open
1 task done

[Bug]: NPE in SessionService.getScheduleBackgroundRunIn #2205

maximkir-fl opened this issue Oct 15, 2024 · 1 comment

Comments

@maximkir-fl
Copy link

What happened?

An early crash occurred to our apps deployed with the recent OneSignal SDK.

The SDK init code is:

open class Application : Application() {
    override fun onCreate() {
        super.onCreate()
        OneSignal.initWithContext(this, getString(R.string.one_signal_app_id))
    }
}

Steps to reproduce?

Check the attached logs; it is pretty straightforward.

What did you expect to happen?

The app did not crash.

OneSignal Android SDK version

5.1.22

Android version

14, 11

Specific Android models

Galaxy S21 FE 5G
Moto G(8) Power
Realme 6Pro
Galaxy S21 5G
Galaxy A70

Relevant log output

Fatal Exception: java.lang.RuntimeException: Unable to stop activity {com.peekaphone.app/com.onesignal.notifications.activities.NotificationOpenedActivity}: java.lang.NullPointerException
       at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5906)
       at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5872)
       at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5943)
       at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:240)
       at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8919)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Caused by java.lang.NullPointerException:
       at com.onesignal.session.internal.session.impl.SessionService.getScheduleBackgroundRunIn(SessionService.kt:43)
       at com.onesignal.core.internal.background.impl.BackgroundManager.scheduleBackground(BackgroundManager.kt:86)
       at com.onesignal.core.internal.background.impl.BackgroundManager.onUnfocused(BackgroundManager.kt)
       at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:377)
       at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:377)
       at com.onesignal.common.events.EventProducer.fire(EventProducer.kt:50)
       at com.onesignal.core.internal.application.impl.ApplicationService.handleLostFocus(ApplicationService.kt:377)
       at com.onesignal.core.internal.application.impl.ApplicationService.onActivityStopped(ApplicationService.kt:198)
       at android.app.Application.dispatchActivityStopped(Application.java:510)
       at android.app.Activity.dispatchActivityStopped(Activity.java:1589)
       at android.app.Activity.onStop(Activity.java:2789)
       at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1623)
       at android.app.Activity.performStop(Activity.java:9236)
       at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5898)
       at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5872)
       at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5943)
       at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:240)
       at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8919)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maximkir-fl
Copy link
Author

Is it possible to disable the session tracking feature altogether?

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

1 participant