-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
SDK init after app start should not require SentryHybridSdkDidBecomeActive #4575
Comments
I can't recall exactly why we came up with this solution. It seemed like a good choice when we implemented it in #913 to fix a related Dart issue getsentry/sentry-dart#274. While your proposal makes sense, why should we change it now? What problem do we solve? We already have it implemented like that in all SDKs; changing it is extra work. |
Even the last one should be reason enough to fix this in the SDK & deprecate/ignore |
The proposed fix consists of doing basically this: Plus tests obviously |
Thanks for the detailed explanation. That makes sense. Do you have the bandwidth to open a PR for this? |
Not any time soon I'm afraid but I'll keep it in mind to check if it's still open for when I do. |
Description
Problem description
There's a notification exposed for hybrid SDKs which they're supposed to call when an app becomes active (
SentryHybridSdkDidBecomeActive
). This is because if the app was already active at the time the normal DidBecomeActive notification is registered, it would never get triggered.The problem with this solution is that it shifts the issues to all individual consuming SDKs (which is bound to fail one way or another, not even taking into account that they need to figure out they're supposed to call this) instead of implementing it here.
Additionally, I wonder how this isn't a problem for anyone else initializing the SDK later while the app is already running? I.e. not talking about hybrid SDKs but any app using the Cocoa SDK.
Proposal:
How about we change the logic and automatically do what
SentryHybridSdkDidBecomeActive
does, i.e. start session if session tracking is enabled. Track OOM, etc.We can first check that the app is in the foreground.
Context
Found this out when figuring out getsentry/sentry-dart#2412 (comment) with a fix in getsentry/sentry-dart#2452
The text was updated successfully, but these errors were encountered: