AndroidConnectivityRetryGate

class AndroidConnectivityRetryGate(context: Context, requireValidatedInternet: Boolean = true) : TransportRetryGate

An implementation of TransportRetryGate that suspends until active internet connection is available.

It uses Android's ConnectivityManager callbacks inside a callback flow to wait for the system to transition to a state where internet is accessible.

Parameters

context

Android context used to retrieve the connectivity service.

requireValidatedInternet

If true, additionally checks for NetworkCapabilities.NET_CAPABILITY_VALIDATED which guarantees that the network has actual, verified access to the internet.

Constructors

Link copied to clipboard
constructor(context: Context, requireValidatedInternet: Boolean = true)

Functions

Link copied to clipboard
open suspend override fun awaitRetryAllowed()

Suspends the current coroutine until retry attempts are allowed.