当前位置: 移动技术网 > IT编程>移动开发>Android > Android8.1原生系统网络感叹号消除的方法

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

2019年07月23日  | 移动技术网IT编程  | 我要评论

黑立德,秋天的战争,金瓶梅快播在线观看

原生系统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
# 使用https
adb shell settings put global captive_portal_https_url xxxxx
# 使用http
adb shell settings put global captive_portal_use_https 0
adb shell settings put global captive_portal_http_url xxxxx
# 使用默认,即删除配置
adb shell settings delete global captive_portal_http_url
adb 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 0
adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
# 使用默认,即删除配置 
adb shell settings delete global captive_portal_http_url
adb shell settings delete global captive_portal_https_url

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网