转 关于 android 5.0 及更高版本网络图标上的感叹号及其解决办法
叹号杀手源码在此:https://github.com/Noisyfox/NoExclamation
7.1.1
从7.1.1开始,检测用的服务器地址储存格式发生了变化,改为了:
1
2
3 |
private static String getCaptivePortalServerHttpsUrl(Context context) { return getSetting(context, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL, DEFAULT_HTTPS_URL); } |
以及
1
2
3 |
public static String getCaptivePortalServerHttpUrl(Context context) { return getSetting(context, Settings.Global.CAPTIVE_PORTAL_HTTP_URL, DEFAULT_HTTP_URL); } |
可以看到,系统不会自动加入”generate_204″的后缀了,这意味着url可以设计的更加灵活,同时也意味着在设置的时候需要填入完整的url:
1 |
adb shell "settings put global captive_portal_https_url https://www.noisyfox.cn/generate_204" |
当然如果只有http的话,可以执行:
1
2 |
adb shell "settings put global captive_portal_use_https 0" adb shell "settings put global captive_portal_http_url http://www.noisyfox.cn/generate_204" |
复原方法见下文。
7.0-7.1.0
需要服务器支持https。 或者使用命令
1 |
adb shell "settings put global captive_portal_use_https 0" |
1 |
adb shell "settings put global captive_portal_use_https 1" |
1 |
adb shell "settings delete global captive_portal_use_https" |
5.0-6.0
升级了安卓5.0的同学们一定对网络图标上面的那个感叹号感到十分郁闷。安卓5.0引入了一种新的网络评估机制来评估网络状况,当你有网络请求时会自动选择网络连接条件最好的一个网络进行连接。该机制的代码实现如下:

那么下面就给出解决方法(无需root):
1.完全屏蔽网络检查功能,最简单快速,但是就没有办法提示wifi登录:
1 |
adb shell "settings put global captive_portal_detection_enabled 0" |
1 |
adb shell "settings put global captive_portal_server noisyfox.cn" |
3.恢复默认值
对于第一条指令,恢复默认只需要执行:
1 |
adb shell "settings put global captive_portal_detection_enabled 1" |
1 |
adb shell "settings delete global captive_portal_detection_enabled" |
1 |
adb shell "settings delete global captive_portal_server" |

如何建立自己的服务器
1. 对于apache服务器,如果你的服务器安装了rewrite模块,那么只需要在网站的.htaccess中加入以下代码:
1
2
3
4
5 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} /generate_204$ RewriteRule $ / [R=204] </IfModule> |
1 |
location /generate_204 { return 204; } |
一键设置工具(需要root)
锵锵锵!由于有些人不太熟悉adb之类的操作,因此就做了一个小工具方便大家直接在手机上设置!
- 下载地址
NoExclamation Portal Server 修改器 2.0
叹号杀手 2.0
- 支持 Android 7.1.1
- 修正了应用崩溃的问题
- 增加图标
- 替换网址为英文网址
- 优化了重置网址功能
- 优化界面,在修改网址时不会导致界面卡顿
一些其它服务网址
我会尽我所能提供长期有效的服务,但是由于本站服务器不是很快,而且网络状况有时候会不稳定,因此无法保证100%可靠的服务。不过有一些热心网友提供了其它服务网址,速度和稳定性或许会比本站要好。故在此特别列出供大家选用。如果给提供者带来不便之处请回复告知,我会及时删除。 by fengz: www.v2ex.com V2EX建立的服务,速度不错,稳定性也很不错 by lkebin: liukebin.avosapps.com 架设于LeanCloud服务器,据lkebin称是永久有效 by Zohar: www.iwch.me 热心网友的个人站点版权属于:lyin
转载时须注明出处及本声明