原生安卓-解决WiFi网络受限以及修改NTP服务器

刷完Lineage OS后网络连接 WiFi和移动网络的叉号或叹号出现,并且提示网络受限但并不影响使用。

谷歌从 Android 5.0 开始就引入了「Captive Portal」机制,主要用来检测 WiFI 网络认证是否正常,默认检测访问的是谷歌服务器。

众所周知谷歌服务器是需要华氏 451工具才能正常访问,所以如果你没有华氏 451工具的情况下,WiFi 就会出现网络受限、WiFi图标出现一个感叹号标志,系统会以为你网络不好,导致网络不稳定。

1、更换 captive 连接验证服务器

Android 7.0之后的版本需要执行下面的4条命令:

adb shell settings delete global captive_portal_https_url

adb shell settings delete global captive_portal_http_url

adb shell settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204

adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204

注意:https://connect.rom.miui.com/generate_204 是连接验证服务器

其他服务器如:
https://captive.lineageos.org.cn/generate_204
https://www.v2ex.com/generate_204

修改完毕后重新开关下飞行模式即可~

2、修改NTP(可选)

当时间不准时在修改使用,一般不用修改(修改为阿里云)

adb shell settings delete global ntp_server

adb shell settings put global ntp_server ntp.aliyun.com

修改完毕后重启手机即可~(jeeinn)

参考文章:
https://doge.uk/coding/android-miui-eu-wifi-captive-portal.html
https://www.cniee.com/android/lineageos_net_erorr.html

Author: thinkwei

1 thought on “原生安卓-解决WiFi网络受限以及修改NTP服务器

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注