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

After reboot, then restarting all apps after app optimization completion leads to repeated crashes of app #129

Closed
leaf-node opened this issue Nov 6, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@leaf-node
Copy link
Member

To work around this, it's possible to force stop the app, then open it again.

type: crash
osVersion: google/shiba/shiba:15/AP3A.241005.015/2024110400:user/release-keys
flags: dev options enabled
package: studio.okcode.open_alert_viewer:1, targetSdk 34
process: studio.okcode.open_alert_viewer
processUptime: 92 + 323 ms

java.lang.RuntimeException: Unable to start service com.dexterous.flutterlocalnotifications.ForegroundService@c4128db with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.content.Intent.getSerializableExtra(java.lang.String, java.lang.Class)' on a null object reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5199)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8744)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ExecInit.main(ExecInit.java:50)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:369)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.content.Intent.getSerializableExtra(java.lang.String, java.lang.Class)' on a null object reference
at com.dexterous.flutterlocalnotifications.b1.a(SourceFile:1)
at com.dexterous.flutterlocalnotifications.ForegroundService.onStartCommand(Unknown Source:10)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5181)
... 11 more
@leaf-node leaf-node added the bug Something isn't working label Nov 6, 2024
@leaf-node leaf-node added this to the Public Release milestone Nov 6, 2024
@leaf-node leaf-node changed the title Repeated crash after reboot, then restart of all apps after app optimization completion After reboot, then restarting all apps after app optimization completion leads to repeated crashes of app Nov 6, 2024
@leaf-node
Copy link
Member Author

@leaf-node
Copy link
Member Author

Using version 18.0.0 of flutter_local_notifications seems to prevent the random crashes that were also occurring with similar stack traces. Hopefully this also resolves the issues with starting the app after automatic app restarts.

@leaf-node
Copy link
Member Author

Try this if the error continues on the new of the app after a phone reboot:

diff --git a/lib/background/repo/notifications.dart b/lib/background/repo/notifications.dart
index 6e49ec2..b61e7a2 100644
--- a/lib/background/repo/notifications.dart
+++ b/lib/background/repo/notifications.dart
@@ -195,6 +195,7 @@ class NotificationRepo {
         ?.startForegroundService(stickyNotificationId, stickyNotificationTitle,
             "$stickyNotificationContentStart $duration",
             notificationDetails: _stickyAndroidNotificationDetails,
+            startType: AndroidServiceStartType.startRedeliverIntent,
             foregroundServiceTypes: {
           AndroidServiceForegroundType.foregroundServiceTypeDataSync
         });

@leaf-node
Copy link
Member Author

The suggestion was to throw an exception, so I went ahead and applied the recommended change mentioned by the exception message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant