0
我正在运行一个小应用程序,通过WifiManager.startScan()/ WifiReceiver扫描可用WLAN网络。一旦检测到特定的开放式网络我试图通过调用该代码连接到它:连接到WLAN网络时Android崩溃
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);
奇怪的位置:在我的平板电脑和一些其他用户的Android智能手机死机!要清楚:这不是我的应用程序失败,整个设备重新启动!那可能是什么原因呢?有没有人知道这个问题的解决方法?或者我的方法连接到网络有什么问题吗?
谢谢!
埃尔米
我认为你可以从这个线索得到答案。 http://stackoverflow.com/questions/4374862/how-to-programatically-create-and-read-wep-eap-wifi-configurations-in-android – 2012-05-11 06:43:56