編輯:高級開發
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiConfiguration wc = new WifiConfiguration();
// This is must be quoted according to the documentation
// http://developer.android.com/reference/android/net/wifi/WifiConfiguration.Html#SSID
wc.SSID = "\"SSIDName\"";
wc.preSharedKey = "passWord";
wc.hiddenSSID = true;
wc.status = WifiConfiguration.Status.ENABLED;
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 res = wifi.addNetwork(wc);
Log.d("WifiPreference", "add Network returned " + res );
boolean b = wifi.enableNetwork(res, true);
Log.d("WifiPreference", "enableNetwork returned " + b );
在我們教程系列的第一部分中,我們使用android和Eclipse開發了一個簡單的飲茶計時器的應用程序。在第二部分,我們將繼續開發這個程序,並給它增加一些其他的額外的功
Next,接受其中的協議,最後會自動安裝。 四、下載 android SDK 下載Android SDK 選擇 android-sdk_r10-Windows.zi
繼PHP for android實現之後,微軟.Net for android,也就是MonoDroid,也將馬上進入Beta測試階段,最終的MonoDroid產品將在
/developer.android.com/sdk/installing.Html(洋文,被牆) 下載後解壓。 假設解壓後是/home/chen/下載/andro