Hari Babu Mandala
Hari Babu Mandala

Reputation: 295

How to get scanned wifi networks security type? And what is the network configuration required to connect to particular network using WiFi in android?

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:

  1. WEP Network requires:

    wifiConfigObj.wepKeys[0] = "\"" + networkPass + "\"";
    wifiConfigObj.wepTxKeyIndex = 0;
    wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    wifiConfigObj.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    
  2. EAP Network requires:

     wifiConfigObj.preSharedKey = "\""+ networkPass +"\"";
    
  3. 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

Answers (1)

Prince Agrawal
Prince Agrawal

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

Related Questions