Version 1.0.3
connectWifi
: function(ssid, pass, success, error)
connectWifiOpen
: function(ssid, success, error)
/* boolean */ isWifiEnabled
: function(success, error)
setWifiEnabled
: function(enabled, success, error)
/* boolean */ isWifiConnected
: function(success, error)
/* string */ getCurrentSSID
: function(success, error)
/* string */ getMacAddress
: function(success, error)
/* Array<Object> */ listWifiNetworks
: function(success, error)
/* Array<string> */ getConfiguredNetworks
: function(success, error)
cordova plugin add com.gurvanhenry.cordova-plugin-wifi
var success = function(message) { alert(message); };
var error = function(message) { alert("Error"); };
Wifi.isWifiEnabled(this.success, this.error);
Wifi.setWifiEnabled(true, this.success, this.error);
Wifi.connectWifi("wifispot", "megapass", success, error);
Wifi.getMacAddress(this.success, this.error);
https://github.com/gurvanhenry/cordova-plugin-wifi-sample
-
getMacAddress
complexity- Android do not provide mac address with
WifiInfo
on Android >= 6- new security rules: see API 6 changes
- see code Wifi.java getMacAddress_sol1()
- the result will be "02:00:00:00:00:00"
- This plugin include a workaround that use network information
- see code Wifi.java getMacAddress_sol2()
- Android 7 changed the rule again
- DevicePolicyManager can be used see API 7 changes
- this plugin do not handle that case
- Android do not provide mac address with
-
listWifiNetworks
permission issue- Since Android 6 (again)
ACCESS_COARSE_LOCATION
location permission as to be asked on runtime (popup)
- Since Android 6 (again)