views:

79

answers:

0

Hi,

I have written code for adding open network to wifi configured list.It adds the open network to configured lists and displays the same SSID's in Wifi Settings.but it adds the same network with same name extra but it doesn't shows any open network When i press on the second on alert shows with Security WEP the following text i observed with those same networks

1) Open network 2) remembered , not in range But i want to add open network into my list, why this extra one is added and if i connect the same network it is trying to connect to the (2) one programmatically.Actually I changed secured network to open network for this trial.It displays with open network text and when i press on that one it obtains the address and connects succesfully manually.Why this extra one is adding how can i add the open network to my list.For reference plz see the link for image.

http://www.freeimagehosting.net/uploads/3dbccfc2bd.png

Code snippet :

    String hotSpotSsid = hotSpot.SSID;
    String hotSpotBssid = hotSpot.BSSID;
    Log.i(TAG,"in RSSI Changed Acion SSID: "+hotSpotSsid+" BSSID: "+hotSpotBssid);
    StringBuffer sBuf = new StringBuffer("\"");
    sBuf.append(hotSpotSsid+"\"");
    hotSpotSsid = sBuf.toString();

    WifiConfiguration wifiConfiguration = new WifiConfiguration();
    wifiConfiguration.SSID = hotSpotSsid;
    wifiConfiguration.allowedKeyManagement.set(KeyMgmt.NONE);
    wifiConfiguration.BSSID = hotSpotBssid;
    wifiConfiguration.hiddenSSID = false;
   // wifiConfiguration.priority = 1;

    // add this to the configured networks
    int inetId = wifiManager.addNetwork(wifiConfiguration);
    Log.i(TAG,"INetId :"+inetId);
    configs = wifiManager.getConfiguredNetworks();
    Log.e(TAG,"After adding config :"+configs);
    if(inetId < 0) {
        Log.i(TAG,"Unable to add network configuration for SSID: "+hotSpotSsid);
        return;
    }else {
        message="\t Successfully added to configured Networks";
        Log.i(TAG,message);
    }

regards, Rajendar