InternetAvailabilityPolicy

Presets that define how strict the SDK should be when deciding whether “Internet is available”.

Each preset is represented as a set of Android capability IDs (see android.net.NetworkCapabilities.NET_CAPABILITY_*) that must be present on a network, typically checked via android.net.NetworkCapabilities.hasCapability.

Notes on the capabilities used here:

  • NET_CAPABILITY_INTERNET means the network advertises that it can provide general Internet connectivity. This is not a guarantee of real reachability (e.g., captive portal or broken upstream may still exist).

  • NET_CAPABILITY_VALIDATED means the system has verified that the network can actually reach the Internet (system validation/probing). This reduces false positives and is usually the closest system-level signal to “online”.

Inheritors

Types

Link copied to clipboard

A permissive preset: considers Internet “available” if the network has AndroidNetworkCapabilities.NET_CAPABILITY_INTERNET.

Link copied to clipboard

A strict preset: considers Internet “available” only if the network has both AndroidNetworkCapabilities.NET_CAPABILITY_INTERNET and AndroidNetworkCapabilities.NET_CAPABILITY_VALIDATED.