Code example for WifiConfiguration

2
	 
	 public static void controlStockTether(WifiManager wifimanager, boolean enabled, boolean encryptionEnabled, String passphrase) throws Exception {
		  
    	Log.d(TAG, "fallback tether mode starting: " + enabled);
    	//Config setup 
        WifiConfiguration config = new WifiConfiguration();
        config.SSID = "TetherFallback"; 
         
         
        if(!encryptionEnabled){
        	Log.d(TAG, "open AP mode ");
        	config.allowedKeyManagement.set(WifiConfiguration.AuthAlgorithm.OPEN);
        } else 
        { 
        	Log.d(TAG, "Shared AP mode ");
        	config.allowedKeyManagement.set(WifiConfiguration.AuthAlgorithm.SHARED);
        	config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
        	config.preSharedKey = passphrase;
        } 
         
        //TODO: tkip