hoerresb / WifiWizard

A Cordova plugin for managing Wifi networks
Apache License 2.0
205 stars 178 forks source link

What network types are supported? #50

Open jorisw opened 8 years ago

jorisw commented 8 years ago

The docs mention:

Currently, only WPA is supported for the algorithm value.

What does this mean in practice? Does this mean only networks with WPA authentication can be joined? What about WPA2, WPA-PSK, WPA Enterprise, WEP, or even open networks?

hoerresb commented 8 years ago

WPA, WPA2, WPA-PSK are supported. WEP is not supported and I'm not sure about WPA Enterprise.

However, we are able to support whatever android supports since we interact with android wifimanager directly. If you have a specific algorithm you want support for I'm sure we can add it.

let me know, thanks.

jorisw commented 8 years ago

Any way to just abstract the network type out of the process?

Since I cannot predict the type of WiFi my users intend to use, I'd prefer not to worry about it and just have them supply the SSID and password.

However, I realize that some networks require a username also. But since the array of networks coming back from the scan, don't reveal the authentication type, I wouldn't know how to anticipate this. The same goes for open networks actually. I would prefer to just let the user join those without prompting for a password first. Any way that the scan results could include the type of network?

In comparison: If you open the AirPort dropdown on a Mac with the alt key down, you can see the type of every network in range. My guess is that my Mac didn't have to say hi to every network to get their authentication type.

Does Android's WiFi manager return this at all, and if so, can this be included in the scan results?

hoerresb commented 8 years ago

Yes the scan result should be returning the wifi capabilities. ScanResult.capabilities describes the authentication, key management, and encryption schemes supported by the access point.

If the wifi network has a captive portal like you get at an airport or hotel there is really no way around that.

The way the add network function works right now is it checks the authentication type. If auth == wpa else if auth == wep else if auth == NONE. So, you should be able to add to most wpa networks and open networks. However, this may not be the best way to go about determining the network type, as you pointed out if it's an open network the user shouldn't be prompted for a password.

seethun commented 7 years ago

I'm trying this plugin on Android 5.x and 6.x. I have an open Wifi network which I need to add and then connect to. I'm not able to add the open network to the phone. The plugin returns an error saying incorrect protocol for NONE, and doesnt work for the said network if I try WPA as the protocol.

Any ideas how I can connect to an open network?

var config = WifiWizard.formatWifiConfig(wifi_ssid, "", "NONE");//None - incorrect protocol; WPA not working for device... console.log("connectWifi: ", wifi_ssid, config); console.log("calling addNetwork..."); WifiWizard.addNetwork(config, function() { console.log("addNetwork done! now calling connectNetwork..."); WifiWizard.connectNetwork(wifi_ssid, win_wifi, fail_wifi); }, fail_wifi);