【问题标题】:DHCP and Proxy Settings AndroidDHCP 和代理设置 Android
【发布时间】:2013-03-12 11:22:51
【问题描述】:

我正在为 Android 创建一个应用程序,该应用程序连接到已通过配置的无线网络。我按照How to programmatically create and read WEP/EAP WiFi configurations in Android? 连接到 WEP 网络,但它不起作用。当我通过 Wifi 设置连接时,它连接没有任何问题。从以编程方式添加的网络和通过 Wifi 设置添加的网络分析 WifiConfiguration,区别在于它们的 ip 分配和代理设置:

 # 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 和代理设置吗?我相信这些数据将使连接成为可能。

谢谢!

【问题讨论】:

    标签: android android-wifi dhcp wifimanager wifi


    【解决方案1】:

    实际上问题出在我的 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 + "\"";
    

    希望对你有帮助。

    问候。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-13
      • 2023-03-25
      • 1970-01-01
      • 2019-04-18
      • 1970-01-01
      • 1970-01-01
      • 2015-07-26
      相关资源
      最近更新 更多