I'm creating wifi hotspot with the following code and it's working.
WifiConfiguration netConfig = new WifiConfiguration();
netConfig.SSID = apDefaultSSID;
netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
netConfig.preSharedKey = apDefaultPassword;
But it's making a WPA-PSK security type.How can I create hotspot only WPA2-PSK?