Grant Park
Grant Park

Reputation: 1044

How does Google validate network connectivity when using NET_CAPABILITY_VALIDATED?

Out of curiosity, what method is Google using to validate a working internet connection? Are they hitting a universal endpoint? https://developer.android.com/reference/android/net/NetworkCapabilities#NET_CAPABILITY_VALIDATED

Any link to some AOSP would be very helpful as well.

Upvotes: 4

Views: 1365

Answers (1)

Rick Sanchez
Rick Sanchez

Reputation: 4746

Your question got me curious and searched on cs.android.com (AOSP viewer) a bit.
Looks to me that the stack does a probing step here in order to move to VALIDATED state in this part of code here

The first thing it checks is whether we are in a captive portal situation. The default URL to check that is here in ConnectivityService:

  private static final String DEFAULT_CAPTIVE_PORTAL_HTTP_URL =
            "http://connectivitycheck.gstatic.com/generate_204";

Upvotes: 3

Related Questions