2013-03-22 97 views
1

我正在爲Android創建一個應用程序,該應用程序通過配置連接到無線網絡。我跟着這How to programmatically create and read WEP/EAP WiFi configurations in Android?,連接到WEP網絡,但它不起作用。當我通過Wifi設置連接時,它沒有任何問題連接。從以編程方式加入網絡,並從分析WifiConfiguration的由WiFi設置不同的是它們的IP分配新建分配FY和代理設置補充說:DHCP和代理設置Android

# ProgrammaticallyAdded # 
ID: 8 SSID: "quickframe" BSSID: null PRIO: 40 
KeyMgmt: NONE Protocols: WPA RSN 
AuthAlgorithms: OPEN SHARED 
PairwiseCiphers: TKIP CCMP 
GroupCiphers: WEP40 WEP104 TKIP CCMP 
PSK: 
eap: 
phase2: 
identity: 
anonymous_identity: 
password: 
client_cert: 
private_key: 
ca_cert: 
IP assignment: UNASSIGNED 
Proxy settings: UNASSIGNED 
LinkAddresses: [] Routes: [] DnsAddresses: [] 


# Added by Wifi Settings # 
ID: 8 SSID: "quickframe" BSSID: null PRIO: 17 
KeyMgmt: NONE Protocols: WPA RSN 
AuthAlgorithms: OPEN SHARED 
PairwiseCiphers: TKIP CCMP 
GroupCiphers: WEP40 WEP104 TKIP CCMP 
PSK: 
eap: 
phase2: 
identity: 
anonymous_identity: 
password: 
client_cert: 
private_key: 
ca_cert: 
IP assignment: DHCP 
Proxy settings: NONE 
LinkAddresses: [192.168.0.89/24,] Routes: [0.0.0.0/0 -> 192.168.0.1,] DnsAddresses: [143.106.2.5,143.106.2.2,] 

我也試圖通過反射來添加IP地址分配和代理設置。但它也沒有奏效。

ID: 8 SSID: "quickframe" BSSID: null PRIO: 0 
KeyMgmt: NONE Protocols: WPA RSN 
AuthAlgorithms: OPEN SHARED 
PairwiseCiphers: TKIP CCMP 
GroupCiphers: WEP40 WEP104 TKIP CCMP 
PSK: 
eap: 
phase2: 
identity: 
anonymous_identity: 
password: 
client_cert: 
private_key: 
ca_cert: 
IP assignment: DHCP 
Proxy settings: NONE 
LinkAddresses: [] Routes: [] DnsAddresses: [] 

任何人都知道如何獲得IP和代理設置?我相信這些數據會使連接成爲可能。

謝謝!

回答

0

其實這個問題出現在我的WEP密鑰中,我設置它就像它在我提到的鏈接(How to programmatically create and read WEP/EAP WiFi configurations in Android?)中顯示的那樣。

wc.wepKeys[0] = "\"" + password + "\""; 

當我刪除引用它的工作。

wc.wepKeys[0] = "" + password + ""; 

所以,你只需要設置SSID時使用引號。

wc.SSID = "\"" + ssid + "\""; 

希望它有幫助。

問候。