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]: App crashes when moved to Background (FATAL EXCEPTION) #922

Closed
2 of 3 tasks
mariusbolik opened this issue Sep 27, 2023 · 3 comments
Closed
2 of 3 tasks

[Bug]: App crashes when moved to Background (FATAL EXCEPTION) #922

mariusbolik opened this issue Sep 27, 2023 · 3 comments

Comments

@mariusbolik
Copy link

mariusbolik commented Sep 27, 2023

What happened?

Hello,

I got some user Feedback, that my capacitor app crashes after login and users can't get logged in. I am sending the ID and email of a user to OneSignal after they have logged in.

Tested with:

  • Umidigi One, Android 8.1
  • Samsung Galaxy S52, Android 13

Steps to reproduce?

I am using the Capacitor In-App-Browser to perform an Open ID Login Flow. It seems like the In-App-Browser stops the process of the app. After the Browser was opened, the app gets moved to the background and crashes.

I am using Capacitor 5.4.1!

Edit: I see this error everey time I click the home button which moves the app to the background.

What did you expect to happen?

The app should not crash 👀

OneSignal Cordova SDK version

5.0.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

FATAL EXCEPTION: main
Process: com.myapp.app, PID: 13658
java.lang.RuntimeException: Unable to stop activity {com.myapp.app/com.myapp.app.MainActivity}: java.lang.NullPointerException
	at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4062)
	at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4111)
	at android.app.ActivityThread.-wrap24(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6523)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:865)
Caused by: java.lang.NullPointerException
	at com.onesignal.session.internal.session.impl.SessionService.getScheduleBackgroundRunIn(SessionService.kt:44)
	at com.onesignal.core.internal.background.impl.BackgroundManager.scheduleBackground(BackgroundManager.kt:96)
	at com.onesignal.core.internal.background.impl.BackgroundManager.onUnfocused(BackgroundManager.kt:88)
	at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:325)
	at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:325)
	at com.onesignal.common.events.EventProducer.fire(EventProducer.kt:44)
	at com.onesignal.core.internal.application.impl.ApplicationService.handleLostFocus(ApplicationService.kt:325)
	at com.onesignal.core.internal.application.impl.ApplicationService.onActivityStopped(ApplicationService.kt:184)
	at android.app.Application.dispatchActivityStopped(Application.java:234)
	at android.app.Activity.onStop(Activity.java:1862)
	at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:369)
	at androidx.appcompat.app.AppCompatActivity.onStop(AppCompatActivity.java:257)
	at com.getcapacitor.BridgeActivity.onStop(BridgeActivity.java:98)
	at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1375)
	at android.app.Activity.performStop(Activity.java:7205)
	at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4059)
	at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4111) 
	at android.app.ActivityThread.-wrap24(Unknown Source:0) 
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646) 
	at android.os.Handler.dispatchMessage(Handler.java:106) 
	at android.os.Looper.loop(Looper.java:164) 
	at android.app.ActivityThread.main(ActivityThread.java:6523) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:865) 

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mariusbolik mariusbolik changed the title [Bug]: FATAL EXCEPTION on phones with custom android version [Bug]: FATAL EXCEPTION at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4062) Sep 27, 2023
@mariusbolik mariusbolik changed the title [Bug]: FATAL EXCEPTION at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4062) [Bug]: App crashes when moved to Background (FATAL EXCEPTION) Sep 28, 2023
@mariusbolik
Copy link
Author

I can't use my Capacitor 5 App with OneSignal. Is there any update on this? @jennantilla

@Samin-roadsurfer
Copy link

@mariusbolik do you already have any update on this?

@mariusbolik
Copy link
Author

Hi @Samin-roadsurfer, currently, the app is not crashing anymore. I updated to capacitor 6 and also updated all plugins.

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