title: Wifimanager how to connect to WEP/WAP network
body: <p>I'm trying to develop a very simple wifi manager, where you see the available networks list, you select one, put in a password and connect to it. </p>
  
  <p>So far I can get the networks list and info about each network from the <code>ScanResult</code> object 
  At this point I should implement the connection, UI is on place, but I can't get to connect to the selected network</p>
  
  <p>I understand a wificonfiguration must be set, and via <code>ScanResult.capabilities</code> I can get the type of the network (<code>[WEP],[WPA-PSK-TKIP],[WPA2-PSK-CCMP-preauth]</code>) and set the <code>AuthAlgorithm</code>, the <code>KeyMgmt</code> and the <code>GroupCipher</code>; then I need to...</p>
  
  <pre><code>WifiManager.disconnect();
  WifiManager.enableNetwork(id,true);
  WifiManager.reconnect();
  </code></pre>
  
  <p>I do something wrong tho, because nothing happens. Well, the wifi does get restarted, but it doesn't connect.</p>
  
  <p>What's the correct way to perform a connection? Is there any way to track whether something went wrong or if the connection succeeded?</p>
  
  <p>EDIT:
   I keep getting a <code>-1</code> value on <code>WifiManager.addNetwork()</code> apparently... I set up pretty much everything in <code>WifiManagerConfiguration</code>, I've no idea what may be the problem, any idea?</p>