-
-
Notifications
You must be signed in to change notification settings - Fork 459
Description
Integration
sentry-android
Build System
Gradle
AGP Version
5.9.0
Proguard
Enabled
Version
8.19.0, 8.20.0
Steps to Reproduce
-
Create Android app
-
Run sentry-wizard
-
Add
beforeBreadcrumb
callbackoptions.beforeBreadcrumb = SentryOptions.BeforeBreadcrumbCallback { crumb, hint -> Log.d("MainActivity", "[${Thread.currentThread().name}] BREADCRUMB: message=${crumb.message}, type=${crumb.type}, level=${crumb.level}, category=${crumb.category}, action=${crumb.getData("action")}") crumb }
-
Trigger network changes (e.g.
adb shell svc wifi enable/disable
) -
Observe thread ID and name in the logcat output
2025-09-05 10:57:04.116 7369-7450 MainActivity com.example.sentryandroidapp D [ConnectivityThread] BREADCRUMB: message=null, type=system, level=INFO, category=network.event, action=NETWORK_AVAILABLE 2025-09-05 10:57:04.119 7369-7450 MainActivity com.example.sentryandroidapp D [ConnectivityThread] BREADCRUMB: message=null, type=system, level=INFO, category=network.event, action=NETWORK_CAPABILITIES_CHANGED
Expected Result
For network breadcrumbs, beforeBreadcrumb
is called in the main thread, not in Android's ConnectivityThread
. Is it possible to use ConnectivityManager.registerDefaultNetworkCallback(NetworkCallback, Handler) [API26+] together with MainLooperHandler
Looper.myLooper
?
Actual Result
The network callback is registered without specifying a handler:
Line 761 in 4051bdc
connectivityManager.registerDefaultNetworkCallback(networkCallback); |
This causes beforeBreadcrumb
to be called in Android's internal ConnectivityThread
that downstream SDKs are not aware of, causing random hard-to-reproduce crashes down the line:
Metadata
Metadata
Assignees
Labels
Projects
Status