Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sushichop/cordova-plugin-wifi-manager
Wi-Fi Manager Plugin for Apache Cordova
https://github.com/sushichop/cordova-plugin-wifi-manager
cordova cordova-android cordova-ios cordova-plugin wifi
Last synced: 3 months ago
JSON representation
Wi-Fi Manager Plugin for Apache Cordova
- Host: GitHub
- URL: https://github.com/sushichop/cordova-plugin-wifi-manager
- Owner: sushichop
- License: mit
- Created: 2018-05-04T08:15:43.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T18:27:47.000Z (7 months ago)
- Last Synced: 2024-10-14T21:05:40.677Z (3 months ago)
- Topics: cordova, cordova-android, cordova-ios, cordova-plugin, wifi
- Language: Java
- Size: 409 KB
- Stars: 8
- Watchers: 2
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cordova-plugin-wifi-manager
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sushichop/cordova-plugin-wifi-manager/blob/main/LICENSE)
[![npm version](https://img.shields.io/npm/v/cordova-plugin-wifi-manager.svg?colorB=blue)](https://www.npmjs.com/package/cordova-plugin-wifi-manager)
![GitHub Actions](https://github.com/sushichop/cordova-plugin-wifi-manager/workflows/ci/badge.svg)Wi-Fi Manager Plugin for Apache Cordova
## Supported Platforms
- Android: 5.0 or later
- iOS: 11.0 or later## Installation
```bash
cordova plugin add cordova-plugin-wifi-manager
```**Notice**
When you use this plugin for Android 10 (API level 29) or later, you can connect to the Internet only through your own (cordova) app. This is due to the specification of new Android API, [WifiNetworkSpecifier](https://developer.android.com/reference/android/net/wifi/WifiNetworkSpecifier).
If you want to purposely use the deprecated Android API, run the following.
```
cordova run android --device -- --gradleArg=-PcdvTargetSdkVersion=28
```## Usage
#### Connect to Wi-Fi access point
```javascript
const onDeviceReady = () => {
window.wifiManager.connect(
'SAMPLE_SSID',
'SAMPLE_PASSPHRASE',
() => {
console.log('connect method was successfully called.');
},
(result) => {
console.log('connect method failed to be called.');
console.log(`code: ${result.code}, message: ${result.message}`);
}
);
};document.addEventListener('deviceready', onDeviceReady, false);
```#### Disconnect from Wi-Fi access point
```javascript
const onDeviceReady = () => {
window.wifiManager.disconnect(
'SAMPLE_SSID',
() => {
console.log('disconnect method was successfully called.');
},
(result) => {
console.log('disconnect method failed to be called.');
consoe.log(`code: ${result.code}, message: ${result.message}`);
}
);
};document.addEventListener('deviceready', onDeviceReady, false);
```## License
[mit]: http://www.opensource.org/licenses/mit-license
`cordova-plugin-wifi-manager` is available under the [MIT license][mit]. See the LICENSE file for details.