2
我正在開發一個從wifi列表中選擇WiFi接入點的Android應用程序。我用下面的代碼..在Android中選擇WiFi接入點?
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);
}
我的問題是我不能選擇wifi接入點。每次它顯示以前配置的wifi細節。
你總是可以檢查的源代碼設置應用http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=樹 – schwiz 2010-11-13 16:58:01