安卓:暂时连接到WiFi网络? [英] Android: Temporarily connect to WiFi network?

查看:248
本文介绍了安卓:暂时连接到WiFi网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我连接到使用此code的8open)WLAN网络:

when I connect to an 8open) WLAN network using this code:

WifiConfiguration wifiConfig = new WifiConfiguration(); 
wifiConfig.BSSID =result.BSSID; // BSSID of detected network
wifiConfig.priority = 1; 
wifiConfig.allowedKeyManagement.set(KeyMgmt.NONE); 
wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); 
wifiConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); 
wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); 
wifiConfig.status=WifiConfiguration.Status.ENABLED; 

int netId = scanData.wifiManager.addNetwork(wifiConfig); 
scanData.wifiManager.enableNetwork(netId, true);

...这WiFi连接存储在preferred网络列表。所以,当我尝试,很多时候我得到一个非常庞大的连接列表 - 这是事端我不想

...this WiFi connection is stored in list of preferred networks. So when I try that very often I get a really huge list of connections - and that's somethin I do not want.

所以我的问题:我如何才能暂时建立到WLAN网络的连接,然后让Android不会存放永久?或者是有办法的情况下,它不再需要删除这样的网络?

So my question: how can I establish a connection to a WLAN network just temporarily and let Android not store it permanently? Or is there a way to remove such a network in case it is no longer needed?

谢谢!

推荐答案

当您从网络上断开,刚刚从存储的名单中删除。查看详情这里:<一href=\"http://stackoverflow.com/questions/11529066/in-android-how-do-you-clear-the-wi-fi-list-of-networks-in-settings-via-java\">In Android的,你如何通过Java清除网络在Wi-Fi列表设置?

When you disconnect from the network, just remove it from the stored list. See details here: In Android, How do you clear the WI-FI list of networks in Settings via Java?

这篇关于安卓:暂时连接到WiFi网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆