-
-
Notifications
You must be signed in to change notification settings - Fork 451
Hook User Interaction integration into running Activity in case of deferred SDK init #4337
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
base: main
Are you sure you want to change the base?
Conversation
@@ -6,6 +6,8 @@ | |||
import android.app.Application; | |||
import android.os.Bundle; | |||
import android.view.Window; | |||
import androidx.lifecycle.Lifecycle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual access to these optional deps is guarded by an if-check, I guess that should be good enough. Will do a manual test as well, just to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did a test, works as expected 🚀
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cefe7fd | 445.92 ms | 520.37 ms | 74.45 ms |
6d25951 | 476.36 ms | 536.73 ms | 60.37 ms |
7d05d6e | 409.78 ms | 472.38 ms | 62.59 ms |
7c4015f | 402.46 ms | 454.08 ms | 51.62 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cefe7fd | 1.58 MiB | 2.08 MiB | 505.82 KiB |
6d25951 | 1.58 MiB | 2.08 MiB | 505.87 KiB |
7d05d6e | 1.58 MiB | 2.08 MiB | 507.83 KiB |
7c4015f | 1.58 MiB | 2.08 MiB | 507.85 KiB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
looks good, but now we always set the first Activity via
|
@@ -346,6 +347,13 @@ public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle saved | |||
|
|||
// the first activity determines the app start type | |||
if (activeActivitiesCounter.incrementAndGet() == 1 && !firstDrawDone.get()) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I just realized - we only set the currentActivity for the first activity here right? So it won't be the "last known activity" but rather the first one, which is incorrect, right? E.g. if you launched 3 activities, and then initialized the SDK it would use the wrong one to hook user interactions. Unless I got the above if-check wrong 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that's correct, it's a better rephrase of my comment 😅
@markushi Is it feasible to port to sentry-java@v7, this would help React Native with missing activity issue. (Sadly RN is still on v7.) |
That's a good point, the This RN PR fixes the |
@krystofwoldrich yes, we can backport it to v7! |
📜 Description
Fixes #3746
Fixes #4356
💡 Motivation and Context
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps