How to know the connected WiFi is Walled Gardened (Captive Portal)?
<p>I know there is way to find out whether a WiFi network is a captive portal by checking the response of something like <code>"http://clients3.google.com/generate_204"</code>. </p>

<p>But my question is somewhat different. We all know that on Android when we connect to a WiFi network the connection cycle goes through a number of state mentioned in the class <a href="http://developer.android.com/reference/android/net/NetworkInfo.DetailedState.html" rel="noreferrer">NetworkInfo.DetailedState</a>, like <code>AUTHENTICATING</code>, <code>OBTAINING_IPADDR</code>, <code>VERIFYING_POOR_LINK</code> etc. Also, one of the states is <code>CAPTIVE_PORTAL_CHECK</code> and android system check whether the network which is being connected is captive or not. For this Android uses the <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/net/CaptivePortalTracker.java#CaptivePortalTracker.isCaptivePortal%28java.net.InetAddress%29" rel="noreferrer">CaptivePortalTracker#isCaptivePortal(InetAddress server)</a> which results in a <code>boolean</code>. So we are certain that Android knows whether the connection is restricted (captive) or not</p>

<p>So, my question is <strong>does Android system gives some callback or some state by which we can get to know the Network is captive portal without checking it manually?</strong> Since Android system have already checked the network for captive portal, do we need to do the same thing again?</p>

<p>P.S. I'm only targeting API 19 (KitKat 4.4.2).</p>