Repository navigation
Closed
getsentry/sentry-docs
#20550Labels
Description
Outcome
Replace the current Android WebView guidance — which states the SDK "doesn't interact with the mobile application's web views" — with setup for the new trace-connection support.
Acceptance criteria
- Documents
SentryWebViewTracing.addTracePropagation(webView, allowedHosts...). It writes the native trace into the page assentry-traceandbaggagemeta tags at document start, usingandroidx.webkit'sWebViewCompat.addDocumentStartJavaScript. - Documents the prerequisites:
- the app adds the
androidx.webkit:webkitdependency; - the System WebView supports document-start scripts (minimum version TBD);
- the call is made on the main thread, before
loadUrl; - otherwise the call logs a warning and returns
false.
- the app adds the
- Documents
allowedHostsas a trust boundary, separate fromtracePropagationTargets:- matching covers the host and its subdomains, over https;
- a non-default port in an entry is kept.
- Documents that the page in the WebView must run
@sentry/browserwithbrowserTracingIntegration. - Documents the limitations:
- the trace is a snapshot taken at call time, so call it again to update it for a later page load;
- only the main frame receives it, and only the entry pageload continues the trace;
sentry-transactionis removed frombaggage;- native and web sampling can differ when no span is active;
- Custom Tabs and
loadData/file://content aren't supported (useWebViewAssetLoaderfor bundled pages).
- Wording coordinated with the Apple and React Native WebView doc updates for cross-platform consistency.
References
- Implementation: feat(android): Connect traces with web content in a WebView #6395. The sample screen is
sentry-samples-android'sWebViewActivity. - Meta-tag continuation contract the page should point to: https://docs.sentry.io/platforms/javascript/tracing/distributed-tracing/
- Current Android WebView page to replace: https://docs.sentry.io/platforms/android/configuration/webview/
- Cross-platform parity: RN docs issue (docs: Update React Native WebView guidance for connected traces sentry-react-native#6782), Apple docs issue
Activity
linear-code commentedon Sep 24, 2026
JAVA-745
docs(android): Document connecting WebView traces (getsentry#20550)