Code example for WifiConfiguration

0
	Log.d(TAG, "exiting onLoginClick");
    } 
 
    // Generate a new configuration based on the following params 
    private WifiConfiguration generateWifiConfig(String ssid, String bssid, String security, String password) {
	WifiConfiguration config = new WifiConfiguration();
	config.SSID = "\"" + ssid + "\"";
	config.BSSID = bssid;
	config.status = WifiConfiguration.Status.ENABLED;
	config.priority = 1;
 
	if (security.contains("WPA")) {
	    config.preSharedKey = "\"" + password + "\"";
	    config.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
	} else if (security.contains("WEP")) {
	    config.wepKeys[0] = password;
	    config.wepTxKeyIndex = 0;
	    config.allowedKeyManagement.set(KeyMgmt.NONE);
	} else { 
	    config.allowedKeyManagement.set(KeyMgmt.NONE);