我正在为 Android 创建一个应用程序,该应用程序通过其配置连接到无线网络。我遵循了如何在 Android 中以编程方式创建和读取 WEP/EAP WiFi 配置?, 连接到 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 和代理设置吗?我相信这些数据将使连接成为可能。
谢谢!