Android 关于wifi管理的代码
开启和关闭wifi的代码
1、需要申请的权限
<pre name="code" class="java">WifiConfiguration config = new WifiConfiguration();config.SSID = "\"" + sr.SSID + "\"";config.allowedKeyManagement.set(KeyMgmt.NONE);int networkId = wifiManager.addNetwork(config);if(networkId != -1){ wifiManager.enableNetwork(networkId, false); wifiManager.saveConfiguration();}</pre><p></p><pre></pre><p></p>