首页 > 系统 > Android > 正文

Android8.1原生系统网络感叹号消除的方法

2019-12-12 00:12:28
字体:
来源:转载
供稿:网友

原生系统Android8.1上,WiFi上出现感叹号,此时WiFi可正常访问。

原因

这是Android 5.0引入的网络评估机制:就是当你连上网络后,会给目标产生204响应的服务器发送给一个请求,如果服务器返回的是状态码为204的响应,那么就被认为网络可以访问;否则,如返回的是其他状态码,那么将被视为网络访问需要登录操作等;没有响应的话,就被认为是网络不可访问。这里的情况就是,目标服务器不能正常访问

产生204响应的服务器

加粗网址亲测可行,其余未测试,但可作为一个参考

  • http://connect.rom.miui.com/generate_204
  • http://www.v2ex.com/generate_204
  • https://captive.v2ex.co/generate_204
  • http://www.noisyfox.cn/generate_204
  • http://www.google.cn/

修改&恢复默认

测试系统:Android 8.1。默认使用https来验证,如要使用http,需要先写入关闭https验证的配置,再填写http服务器。然后开启飞行模式,再打开感叹号即可消失。其中,xxxxx即服务器的URL。

# 查看所有配置adb shell settings list global# 使用httpsadb shell settings put global captive_portal_https_url xxxxx# 使用httpadb shell settings put global captive_portal_use_https 0adb shell settings put global captive_portal_http_url xxxxx# 使用默认,即删除配置adb shell settings delete global captive_portal_http_urladb shell settings delete global captive_portal_https_url

禁用此功能

按照上述方法,设置captive_portal_mode的值如下:

0:彻底禁用检测

1:检测到需要登录则弹窗提醒(默认值)

2:检测到需要登录则自动断开此热点并不再自动连接

Android8.0相关源码代码:

 

源代码链接,无需梯子可直达。

Android9 原生系统网络感叹号消除

# 如要使用http,需要先写入关闭https验证的配置,再填写http服务器。然后开启飞行模式,再打开感叹号即可消失。adb shell settings put global captive_portal_use_https 0adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
# 使用默认,即删除配置 adb shell settings delete global captive_portal_http_urladb shell settings delete global captive_portal_https_url

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表