You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
krystofwoldrich
changed the title
fix(init): Try to get Application from Context to register App Lifecycle Integrations
fix(init): get Application from Context to register integrations
Apr 25, 2025
- Sentry will then wrap the other `ContextStorageProvider` that has been configured by loading it through SPI
- If no other `ContextStorageProvider` is available or there are problems loading it, we fall back to using `SentryOtelThreadLocalStorage`
- Fallback to `context.applicationContext` if `Sentry.init(context)` is not instance of Application ([#4355](https://github.com/getsentry/sentry-java/pull/4355))
this needs some more discussion, as there are things that may not make sense for react.
We currently add spans and breadcrumbs for Activities, Fragments and User Interactions. And i don't think they are needed in react. For example, spans may be created by native android, but not passed to react, or they could be passed and get duplicated (like app start or TTID) or there could be some weird behaviour, like TTFD started in native but only stopped in react. @krystofwoldrich What's the reason behind this change?
Also, i think this would affect flutter as well, we should verify it.
Let's have a quick call (also with @buenaflor) before getting this merged, to clarify what kind of integrations are useful / or not. This probably also affects Unity/Unreal.
Just for context this commit [a2f777c] in Sentry RN SDK ensures Application is passed to the Sentry Android SDK (when available, so no integrations should be missing on the RN side).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
React Native Native Modules receive ReactContext which is not instance of Application class.
This fixes missing integrations in RN applications and other cases when supplied context is not directly Application class.
💚 How did you test it?
RN Sample app, added unit tests
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps