Contents

Android 7.1.1 N Ways to Eliminate Network Error Reports

In Marshmallow and previous versions, the method of modifying captive_portal_server is well known. After the Nougat version is updated, this method is useless. The reason, to put it simply, is that the piece of code that detects the network connection has been reloaded! Write! up!

Let’s talk about a few useful methods.

modify system settings

In the Nougat system, the main modifications are two setting items, captive_portal_http_url and captive_portal_https_url

adb root

adb shell settings put global captive_portal_http_url http://google.cn/generate_204

adb shell settings put global captive_portal_https_url https://google.cn/generate_204

But whether to use HTTP or HTTPS to send requests? It can be seen from this that the system obtains the setting item captive_portal_use_https and takes the default value 1 when it cannot be obtained, so the default is HTTPS.

        mUseHttps = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.CAPTIVE_PORTAL_USE_HTTPS, 1) == 1;

If you use HTTPS, one thing to pay attention to is the link of https* Must have a valid certificate * ! Otherwise, the system will judge that the connection is unavailable. Before, my url was set to http://g.cn/generate_204. After testing that http was easy to use, I added an s in front of it as the HTTPS URL. Unexpectedly, the certificate of g.cn was from google.com, and I was I didn’t know that the default value of using HTTPS is 1, so I was distressed for a long time…why there is still this little fork!

Alternate detection server available for HTTPS

Sort by ping value.

https://google.cn/generate_204

https://www.google.cn/generate_204

https://www.qualcomm.cn/generate_204

https://http204.sinaapp.com/generate_204

https://captive.v2ex.co/generate_204

disable network detection

adb shell settings put global captive_portal_detection_enabled 0

This is the same as the previous version. But such a convenient network detection is a bit wasteful if it is turned off.

Modify hosts

It is also excellent to directly modify Google’s Hosts to a domestically available IP.

Modifying hosts requires root and the system partition is mounted as writable.

Android can use this widget:Go Hosts

The good thing is that not only can you go to Valley X without VXX, but you can also install a few hosts that do not advertise, and get X in one fell swoop [great]

source address:

https://raw.githubusercontent.com/racaljk/hosts/master/hosts

Comes with a few to advertise

domestic:

https://github.com/vokins/yhosts/raw/master/hosts

AdAway comes with:

https://adaway.org/hosts.txt

https://hosts-file.net/ad_servers.txt

https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext