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

attach-screenshot on manual Android init #2185

Closed
marandaneto opened this issue Jul 25, 2022 · 1 comment · Fixed by #2186
Closed

attach-screenshot on manual Android init #2185

marandaneto opened this issue Jul 25, 2022 · 1 comment · Fixed by #2186

Comments

@marandaneto
Copy link
Contributor

Description

If you enable the flag using the manifest config it works.
If you flip the flag using the Manual init of the Android SDK, it does not.
The reason is that we don't call registerActivityLifecycleCallbacks because isAttachScreenshot returns false when the event processor is created, the user configuration is triggered only after and later is too late.
Ideally we'd fix this logic https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java#L50-L64=
We could technically install the lifecycle callback anyway and check when the very first process is called and call unregisterActivityLifecycleCallbacks if isAttachScreenshot is still disabled, there's a bit of overhead but I don't see any other solution right now.

Another way would be that Event processors have an install method similar to Integrations that are only called when the SDK is fully inited, but that would require more changes.

Found this issue by debugging getsentry/sentry-react-native#2362

@bruno-garcia
Copy link
Member

I see this blocks getsentry/sentry-react-native#2362 but by itself it seems to be a bug.

We could technically install the lifecycle callback anyway and check when the very first process is called and call unregisterActivityLifecycleCallbacks if isAttachScreenshot is still disabled, there's a bit of overhead but I don't see any other solution right now.

This seems fine as a solution

@marandaneto marandaneto moved this from Needs Discussion to Needs Review in Mobile & Cross Platform SDK Jul 26, 2022
@marandaneto marandaneto added Impact: Medium Type: Bug Something isn't working labels Jul 26, 2022
Repository owner moved this from Needs Review to Done in Mobile & Cross Platform SDK Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants