2013-03-22 106 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 + "\""; 

希望它有帮助。

问候。