Hello,

i have a problem with this code:
*******************************
       WifiManager wifiManager = (WifiManager)
getSystemService(Context.WIFI_SERVICE);

        WifiConfiguration wc = new WifiConfiguration();

        wc.status = WifiConfiguration.Status.ENABLED;

        wc.SSID = "\"NewYork2011\"";
        wc.preSharedKey =  "\"12345ok6789\"";

 
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
 
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
 
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
 
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
 
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
        wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);

        int netId = wifiManager.addNetwork(wc);
        wifiManager.enableNetwork(netId, true);
        wifiManager.setWifiEnabled(true);
*************************************

When I run this code, "NewYork2011" is added in the list without
problems but can not connect. I think the problem may be.
"PreSharedKey" but I can not fix it.

Please, I need someone to help me.

Thanks for everything in advance.
David.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to