Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Overrides the captive portal settings of Android in the People's Republic China Mainland
#!/usr/bin/env sh
adb shell settings put global captive_portal_fallback_url http://g.cn/generate_204
adb shell settings put global captive_portal_http_url http://www.google.cn/generate_204
adb shell settings put global captive_portal_https_url https://www.google.cn/generate_204
adb shell settings put global captive_portal_other_fallback_urls http://www.qualcomm.cn/generate_204
@edwardw

This comment has been minimized.

Copy link

@edwardw edwardw commented Jul 29, 2019

Somehow it didn't work on my pixel 2. Still shows "no internet" WiFi icon.

@edwardw

This comment has been minimized.

Copy link

@edwardw edwardw commented Jul 29, 2019

Figured it out, changing the https check url works:

adb shell settings put global captive_portal_https_url https://www.qualcomm.cn/generate_204
@vip008008

This comment has been minimized.

Copy link

@vip008008 vip008008 commented Jan 23, 2020

How to install this setting in android 8.1 version please let me know

@escape0707

This comment has been minimized.

Copy link

@escape0707 escape0707 commented Mar 13, 2021

@vip008008 I suppose you still didn't figure it out. If you did, why not edit your post and share the way?

So, basically you look up how to use adb to connect to your device, then run commands in the original gist.

Finally, some people mentioned that only captive_portal_http_url captive_portal_https_url is implemented and used. So basically you have to rely on setting these two correctly.

Although if I recall correctly, in Android 12 there will be a new way to work with captive portal things, etc.


Figured it out, changing the https check url works:
adb shell settings put global captive_portal_https_url https://www.qualcomm.cn/generate_204

Make sure to use http url with http setting, and https url with https setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment