Issue
I've got something like this:
wifiNetworks = (ArrayList<ScanResult>) mWifiManager.getScanResults();
Now I can simply get wifi SSID:
wifiNetworks.get(0).SSID
I don't know if network is WEP, WPA, does it have password or not, so I just want to create an Intent, put there SSID or ScanResult and send it to Settings or wherever in order to let user to enter the password and connect to that network. Is it possible? And if not, what is the easiest way to get information about network type and connect programatically to it?
Solution
Check out this link: How do I connect to a specific Wi-Fi network in Android programmatically?.
ScanResult has everything you need to know about the network.
wifiNetworks.get(0).capabilities
gives a string.
capabilities format = [security-key-group cipher]<[security]>
Just separate these 3 values using "-" as separator and get the security.
security can have the following values:
OPEN
WEP
WPA
WPA2
If security = "WEP" then key and group cipher are null.
Answered By - Vikram Gupta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.