Android-Wifi-Hotspot-Manager-Class icon indicating copy to clipboard operation
Android-Wifi-Hotspot-Manager-Class copied to clipboard

Create WPA2 Hotspot

Open bigabig opened this issue 6 years ago • 1 comments

Hey,

I am trying to create an start an WPA2 Hotspot. I managed to start the Hotspot with the right SSID but WPA2 wont work... I think the problem is the WifiConfiguration, but I can't figure it out.

`

    WifiConfiguration wfc = new WifiConfiguration();
    wfc.SSID = "\"" + ssid + "\"";
    wfc.preSharedKey = "\"" + pw + "\"";
    wfc.status = WifiConfiguration.Status.ENABLED;
    wfc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
    wfc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
    wfc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    wfc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    wfc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    wfc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    wfc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    wfc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    wfc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);

    wifiApManager.setWifiApEnabled(wfc, true);

`

Can you help me?

bigabig avatar Jan 17 '18 20:01 bigabig

check out wificonfigturation.keymgmt and you can see public static final int WPA2_PSK = 4. Even though it is a system API, you can still use integer 4 to create a WPA2 hotspot. Pay attention to the password you entered for the network. for preSharedKey. Some devices need """ but some devices may not. It might influence your Wi-Fi connectivity during authentication

legendarylucas avatar Mar 07 '18 15:03 legendarylucas