When connected to the Internet, the system checks if it's in a walled garden, which is simply trying to connect to Google. If it fails, in Android 5, there'll be an exclamation mark on the WiFi icon or signal icon.

In some situations, this is annoying. Say, in China, Google is blocked, the exclamation mark will always be there, which is meaningless.

How can I disable this check, and make the system assume, connected WiFi/mobile data is connected Internet?

  • Reopened because this is a different question IMO. You can wish to disable this without encountering the issue in the other question. – Matthew Read Feb 24 '15 at 20:27
up vote 31 down vote accepted

It's simple. In the terminal (requires root), or in adb shell (does not require root), issue the command

settings put global captive_portal_detection_enabled 0

and reboot. It should be disabled. The existing state can also be verified via the command

settings get global captive_portal_detection_enabled

A response of "null" indicates the global key value has not been set and Android will fall back to default of being on and performing the detection. If the detection is disabled the response of "0" will be received.

More info: Android : How to remove “captive portal” detection on android 4.2.2 and 4.3

It also works in 5.

  • Great! I note that the link describes doing this in 4.2.2 and 4.3. Have you (or anybody else) verified that this also works in 5.0.x? – Flyto Feb 23 '15 at 17:03
  • @SimonW yes, it works. That's why I tagged the question lollipop. I'm using CyanogenMod 12 though. – TheoYou Feb 24 '15 at 2:36
  • I am in android noob. Do I need to root it to get this to go? – Christian Bongiorno Jun 3 '15 at 1:17
  • 1
    Comment by Gery, lacking the rep for it: For the ones who use terminal for the first time, don't forget to put the command "su" before you do anything, to allow superuser permissions. (It took a while for me to figure why am getting "permission denied") After that it worked like a charm. – Izzy Jul 6 '15 at 13:07
  • 1
    Starting from Nougat (I guess, might be 7.1.2 only, or already Marshmallow), use settings put global captive_portal_mode 0 instead, see jira.lineageos.org/browse/REGRESSION-620 – bonob Oct 20 '17 at 11:40

In the Android M Developer Preview for Shamu (Nexus 6), and possibly other builds of this OS, the captive_portal_server global is used by the OS regardless of the state of captive_portal_detection_enabled in order to determine health of a WiFi network.

For WiFi networks, it will not only draw an exclamation mark on the strength icon, it will blacklist that SSID from auto-reconnecting if it does not successfully curl the URL specified in the the captive_portal_server global via that SSID. Manual reconnection is allowed but will only remain connected if you have captive_portal_detection_enabled and choose "Use This Network As-Is" manually, each time you connect to that WiFi SSID. This override is temporary.

For mobile provider networks, the captive_portal_server is only used to draw an exclamation mark on the strength icon but will remain connected, and traffic will flow if the connection is functional.

On your rooted device, the solution is to re-enable captive_portal_detection_enabled if you have disabled it, connect to that WiFi network, select "Use This Network As-Is" from the drop down menu in the captive portal pop-up, disable your mobile network data to focus on determining a website that can be retrieved via your Wifi network by logging in to your captive portal and then use a browser to find one that works. After that, you can disable captive_portal_detection_enabled to prevent the annoying pop-up.

To reenable your captive_portal_detection, if you previously disabled it, issue the command:

settings put global captive_portal_detection_enabled 1

Disable your Mobile Network (under Settings - Data Usage - Mobile Data - Off), to force the phone to use the WiFi network for all traffic, temporarily. This will not be required once you have all of your settings where they need to be.

Android M seems to require a website that loads successfully and does not actively return a 204 (no content).

A couple of options include but are not limited to

androidcheck.kiritostudio.com
captive.apple.com
www.textise.net
the network router
localhost
127.0.0.1 (if you have an onboard simple HTTP server)
and the list goes on...

After finding one that works for your WiFi Network (often requires more imagination and attempts behind corporate web gateway proxies that do not like HTTPS traffic prior to authentication), you can save the server.

Save the server by running this in your root enabled terminal app, replacing the example URL with the one you are hoping will work:

settings put global captive_portal_server androidcheck.kiritostudio.com

Restart your device. Try it out. Once you are happy with the behavior of the Exclamation Marks on the icons, the final step is to disable the captive portal pop-up, which is one of the most unfortunate inventions of this decade.

Issue command:

settings put global captive_portal_detection_enabled 0

If you find yourself in a different country or WiFi situation where issues arise, unfortunately you will need to repeat the above from the beginning, reenabling captive_portal_detection_enabled, restarting, finding the right server and then disabling the portal detection afterwards.

  • Did you mean HTTP 204 (no content) or HTTP 404 (not found)? Currently I changed to "no content" based on another answer – Andrew T. Sep 10 '15 at 8:43
  • This solved the "connected, no internet" problem on Nougat. Running fresh-flashed CM14.1 (7.1.2) on Nexus. – Yvon Sep 17 '17 at 14:21

You can setup your captive portal server address to it.

settings put global captive_portal_server g.cn

Then, restart your phone.

PS: Before that, you can validate the server is available.

http://g.cn/generate_204

  • Prefer g.cn for mainland China – zhangyoufu Nov 17 '15 at 16:00
  • I get a HTTP Error 404.0 - Not Found – Lucky Dec 17 '15 at 7:31
  • @Lucky Please use g.cn. – Kebin Liu Jul 25 '16 at 14:31

protected by Community Jul 10 '15 at 13:37

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.