在 AOSP / Android 类原生系统上解决 Wifi 连接警告问题

自 Android 5.0 起,谷歌引入了Captive Portal的机制,用于检测 WiFi网络认证是否正常。由于众所周知的原因,我们在中国大陆并无法访问谷歌的网络,这在某些情况下会导致一些问题,例如:在中国大陆使用一些类原生的ROM时,会提示Wifi连接正常,但无法访问互联网

我们可以通过打开USB调试,并执行以下命令来修复这个问题。

shell 复制代码
adb shell settings put global captive_portal_http_url http://api.hestudio.net/generate_204
adb shell settings put global captive_portal_https_url https://api.hestudio.net/generate_204

详细解释:

我们通过替换captive_portal_http_urlcaptive_portal_https_url的值,来修复这个问题。我们将captive_portal_http_urlcaptive_portal_https_url更换为我们自己的API,当然你也可以更换成其他的服务。

shell 复制代码
# MIUI
adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
adb shell settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204
相关推荐
茶栀(*´I`*)25 分钟前
Android 测试入门指南:ADB 基础配置与常用设备管理命令解析
android·adb
gxgldyh2 小时前
Android Framework源码解析(七):BootAnimation 启动流程解析——开机动画是如何显示出来的?
android
达达尼昂3 小时前
在 Claude Cowork 中用好 Claude Fable 5
android·人工智能·后端
sTone873754 小时前
写时复制COW的第一性理解
android·c++·flutter
sTone873754 小时前
Zygote的第一性理解
android
sTone873754 小时前
类RN框架通过Service暴露卡片渲染能力给AI Chat
android·react native
灯火不休4 小时前
Android Studio & Flutter 构建命令完全指南
android
杉氧4 小时前
Ktor 全栈之路 (5):JWT 认证全流程实战 —— 打造安全通信闭环
android·架构·kotlin
️学习的小王4 小时前
Python + MySQL 学生信息管理系统实战教程
android·python·mysql
帅次4 小时前
Android 高级工程师面试:Flutter 路由导航 近1年高频追问 18 题
android·flutter·面试