# Network Disruption

When a participant's network connection drops during a call, the SDK automatically attempts to reconnect. You can configure how long the SDK waits before automatically leaving the call, and detect when reconnection permanently fails.

## Configuring the Disconnection Timeout

The disconnection timeout determines how long a user can remain disconnected before the SDK automatically calls `leave()` and removes them from the call. Configure this when initializing the `StreamVideo` client:

```kotlin
val client = StreamVideoBuilder(
    context = context,
    apiKey = apiKey,
    user = user,
    token = token,
    leaveAfterDisconnectSeconds = 60, // Leave call after 60 seconds of disconnection
).build()
```

By default, `leaveAfterDisconnectSeconds` is set to `30` seconds. Setting it to `0` disables automatic leaving, allowing users to remain in the call indefinitely until they manually hang up or their connection restores.

## How It Works

When a user's network connection drops:

1. The SDK enters reconnecting state (`call.state.isReconnecting` becomes `true`)
2. The SDK starts the disconnection timer
3. The SDK attempts to reconnect automatically
4. If reconnection succeeds before the timeout expires, the call continues normally
5. If the timeout expires without successful reconnection, the SDK automatically calls `leave()` and the connection state transitions to `RealtimeConnection.Failed`

<admonition type="note">
The `leaveAfterDisconnectSeconds` parameter is client-level and applies to all calls. Unlike React and iOS SDKs which provide `call.setDisconnectionTimeout()` for per-call configuration, Android requires setting the timeout when creating the client.
</admonition>

## Detecting Connection Failure

For advanced scenarios where you need to detect permanent connection failure, observe the `call.state.connection` flow. When the disconnection timeout expires, the connection state transitions to `RealtimeConnection.Failed`:

```kotlin
@Composable
fun CallWithDisconnectionHandling(call: Call) {
    val connection by call.state.connection.collectAsStateWithLifecycle()

    when (connection) {
        is RealtimeConnection.Reconnecting -> {
            // Show reconnecting UI (see Connection Unstable guide)
            ReconnectingOverlay()
        }
        is RealtimeConnection.Failed -> {
            // Connection permanently failed after timeout
            val error = (connection as RealtimeConnection.Failed).error
            ErrorDialog(
                title = "Connection Failed",
                message = "Unable to reconnect to the call",
                onDismiss = { /* Navigate away */ }
            )
        }
        is RealtimeConnection.Connected,
        is RealtimeConnection.Joined -> {
            // Normal call UI
            CallContent(call = call)
        }
        else -> {
            // Other connection states
        }
    }
}
```

For basic reconnection UI without failure detection, see the [Connection Unstable](/video/docs/android/ui-cookbook/connection-unstable/) guide which covers the simpler `call.state.isReconnecting` pattern.


---

This page was last updated at 2026-07-10T16:05:26.796Z.

For the most recent version of this documentation, visit [https://getstream.io/video/docs/android/ui-cookbook/network-disruption/](https://getstream.io/video/docs/android/ui-cookbook/network-disruption/).