Socket
Book a DemoInstallSign in
Socket

com.gurvanhenry.cordova-plugin-wifi

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.gurvanhenry.cordova-plugin-wifi

Manage wifi on your device

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

cordova-plugin-wifi

Version 1.0.3

API

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)

Installation

Add plugin in cordova app

cordova plugin add com.gurvanhenry.cordova-plugin-wifi

Basic Usage

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);

Check out more with this sample

https://github.com/gurvanhenry/cordova-plugin-wifi-sample

Notes

  • 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
  • listWifiNetworks permission issue

    • Since Android 6 (again) ACCESS_COARSE_LOCATION location permission as to be asked on runtime (popup)

Keywords

ecosystem:cordova

FAQs

Package last updated on 06 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts