Reputation: 295
I am new to android development & I am trying to create an app which connects to available wifi network for data communication. There are various security types for wifi network configuration.(EX WEP, etc). How to know which network is using which security type? & after knowing that, how to connect to particular network.
I've searched a lot for my problem, & found this:
WEP Network requires:
wifiConfigObj.wepKeys[0] = "\"" + networkPass + "\"";
wifiConfigObj.wepTxKeyIndex = 0;
wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
wifiConfigObj.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
EAP Network requires:
wifiConfigObj.preSharedKey = "\""+ networkPass +"\"";
Public Network requires
wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
But still I am unable to get any clarity. Please Let me know how to get through it. Thanks..
Upvotes: 2
Views: 1521
Reputation: 3607
See answer given by ayj in this question.
In case link doesn't work in future, let me copy paste it for you here.
You need to parse the ScanResult's capabilities string in the scanComplete method. According to the Android developer documentation, :
ScanResult.capabilities describes the authentication, key management, and encryption schemes supported by the access point.
You might be able to make use of -- or at the very least use as an example -- the static helper methods available in the AccessPointState class.
Upvotes: 1