Code example for WifiManager

Methods: addNetworkenableNetwork

0
 
		tmpConfig.preSharedKey = "\"".concat(key).concat("\"");
 
		tmpConfig.status = WifiConfiguration.Status.ENABLED;
 
		int netId = wifi.addNetwork(tmpConfig);
		Log.d("Connect", "Netid:" + String.valueOf(netId));
		boolean sucess = wifi.enableNetwork(netId, true);
		Log.d("Connect", "Sucess:" + String.valueOf(sucess));
		return sucess;
		//return wifi.enableNetwork(netId, true); 
	} 
 
}