Android - How does WiFi in android detect if the device has to sign in or not?

The detection url differs between different Android versions.

For Marshmallow, it uses connectivitycheck.gstatic.com/generate_204, check the code here AndroidXRef - Marshmallow 6.0.0_r1

For Kitkat, it uses clients3.google.com/generate_204 check the code AndroidXRef - KitKat 4.4.4_r1


This technology is called "Captive portal". There are several implementations. As I know, Android tries to reach a file named generate_204 on one of the Google servers and if it is not possible, a notification in generated.

Further reading on Wikipedia: Captive_portal


A captive portal is generally implemented by directing all traffic to a valid HTTP response (200). This HTTP response is what appears in the captive portal.

This can be done with tools like iptables or dnsmasq.