# com.gurvanhenry.cordova-plugin-wifi

> Manage wifi on your device

Latest version **1.0.3** (published 2018-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install com.gurvanhenry.cordova-plugin-wifi
pnpm add com.gurvanhenry.cordova-plugin-wifi
yarn add com.gurvanhenry.cordova-plugin-wifi
bun add com.gurvanhenry.cordova-plugin-wifi
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-02-06 |
| First published | 2018-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gurvan Henry gurvan.henry@gmail.com> |
| Maintainers | gurvanhenry |
| Keywords | ecosystem:cordova, cordova-android, cordova, plugin, wifi |

## Links

- npm: https://www.npmjs.com/package/com.gurvanhenry.cordova-plugin-wifi
- Repository: https://github.com/gurvanhenry/cordova-plugin-wifi
- Homepage: https://github.com/gurvanhenry/cordova-plugin-wifi#README
- Issues: https://github.com/gurvanhenry/cordova-plugin-wifi/issues
- npm.io page: https://npm.io/package/com.gurvanhenry.cordova-plugin-wifi

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-02-06
- 1.0.2 — 2018-01-18
- 1.0.1 — 2018-01-17
- 1.0.0 — 2018-01-17
- 0.2.3 — 2018-01-17

## README

# 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

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

### Basic Usage

```javascript
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](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](https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id)
    - 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](https://developer.android.com/about/versions/nougat/android-7.0-changes.html#afw)
    - 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)

---
_Source: https://npm.io/package/com.gurvanhenry.cordova-plugin-wifi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
