admin管理员组文章数量:1540702
目前Android的WiFi自动连接的优先级规则如下:
1、priority值的范围设定为[0,1000000),如果超出此范围则会reset;
2、最近连接过的AP拥有最高priority,在自动连接中会首先尝试连接它;
3、未连接过但是扫描到的AP,按其信号值强弱排序,越强的显示靠前,但是,还得综合
AP的安全因素,基本情况是:WPA/WPA2 > WEP > signal level high > signal level low > noise low > noise
high
4、如果是预置的AP,可能会人为设定其最高的priority;
看一下源码,代码路径:frameworks/base/wifi/java/android/net/wifi/
WifiConfigStore.java
boolean selectNetwork(int netId) {
if (VDBG) localLog("selectNetwork", netId);
if (netId == INVALID_NETWORK_ID) return false;
// Reset the priority of each network at start or if it goes too high.
if (mLastPriority == -1 || mLastPriority > 1000000) {
Xlog.d(TAG, "Need to reset the priority, mLastPriority:" + mLastPriority);
for(WifiConfiguration config : mConfiguredNetworks.values()
版权声明:本文标题:android自动连接wifi,Android自动连接WiFi优先级规则,以及查看已连接WiFi的密码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1727035436a1095005.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论