retryWhenConnected

Creates an interceptor that, while the device is not connected, retries a retryable failure (see NetworkException.isRetryable) once connectivity returns.

For a retryable failure while Connectivity.connectionStatus is Connectivity.Status.NotConnected, the interceptor returns a RetryPolicy.AfterEvent that fires the next time the status is no longer Connectivity.Status.NotConnected. Otherwise it returns RetryPolicy.DoNotRetry, so it is meant to be combined with retryWithBackoff.

While the status is Connectivity.Status.Unknown a failure is not held back waiting for connectivity, as the SDK does not hold back sending for that status.

Return

A new RequestInterceptor; it can be shared between clients.

Parameters

connectivity

The Connectivity used to know when the device is connected again.