【踩坑】原生Android去除wifi叉号

前言

安装完LineageOS系统(最接近原生的Android系统)后,连接wifi显示红叉,事实上有网络,只不过网络检查服务器默认指向的是谷歌的服务器,因为国内无法访问谷歌服务器,所以导致没办法评估网络,显示感叹号或叉号

准备工作

  • adb工具

修改网络检查服务器的指向

  • 将网络检查服务器修改为http://developers.google.cn/generate_204http://developers.google.com/generate_204
1
2
3
4
adb shell settings delete global captive_portal_http_url
adb shell settings delete global captive_portal_https_url
adb shell settings put global captive_portal_http_url http://developers.google.cn/generate_204
adb shell settings put global captive_portal_https_url https://developers.google.cn/generate_204

禁用网络检查

1
adb shell settings put global captive_portal_detection_enabled 0

踩坑

  • 如果连接的Wifi需要通过portal验证,由于禁用了网络检查,会导致无法验证

恢复网络检查

1
adb shell settings put global captive_portal_detection_enabled 1

完成

  • 重启wifi

参考文献

QQ群——世界隐性-资源及讨论
少数派——化学心情下2