androidandroid-sourceandroid-connectivitymanager

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.


Solution

  • 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";