A session is marked as crashed and sent to Sentry.
We could start the session earlier. Synchronously on init if autoSessionTracking is true.
This is how it's done in .NET. There, a session is also closed on Close, so that on restart, a file isn't found on disk with a 'unfinished' session. That way, we know not to finish that session as abnormal.
e.g: On Android, instead of starting it when the App goes to the foreground (LifecycleWatcher.onStart) we could do it earlier. E.g. synchronously in init.
Steps to Reproduce
Capture an exception right after Sentry.init
Expected Result
A session is marked as crashed and sent to Sentry.
We could start the session earlier. Synchronously on
init
ifautoSessionTracking
is true.This is how it's done in .NET. There, a session is also closed on
Close
, so that on restart, a file isn't found on disk with a 'unfinished' session. That way, we know not to finish that session as abnormal.e.g: On Android, instead of starting it when the App goes to the foreground (LifecycleWatcher.onStart) we could do it earlier. E.g. synchronously in init.
Actual Result
There is no session thus nothing is reported.
Affects Android https://github.com/getsentry/sentry-java/issues/2241 and Cocoa https://github.com/getsentry/sentry-cocoa/issues/2150