ConnectivityHints
Feeds real request outcomes into a ConnectivityMonitor:
any response (whatever its status) → ConnectivityMonitor.reportReachable;
a connection failure (I/O error, DNS failure, timeout) → ConnectivityMonitor.requestRecheck.
What the monitor does with each hint is configured on the monitor (hints { ... }): by default a response marks online and a failure triggers a fresh check, never an instant "offline". Cancelled requests (the user left the screen) are never reported. Install it in common code: on Android and iOS the monitor ignores hints unless hints { applyOnNativePlatforms = true }.
HttpClient(engine) {
install(ConnectivityHints) { monitor = connectivityMonitor }
}Content copied to clipboard