react-native-wifi-connect
Version:
Connect Wifi Local Only Hotspot
76 lines (53 loc) • 1.04 kB
Markdown
# react-native-wifi-connect
Interconnect WiFi
## Installation
```sh
yarn add react-native-wifi-connect
```
## Usage
```js
import {
wifiSwitch,
startHS,
stopHS,
connect,
isWifiOn,
} from 'react-native-wifi-connect';
```
<hr><br>
### Switch WiFi
```js
wifiSwitch();
```
### Start local only hotspot with no internet capabilities
Returns temp ssid and passphrase separated by #.
```js
startHS().then((ssid_pass) => {
console.log(ssid_pass); // return ssid and pass in Object {"ssid":"AndroidShare_1234","pass":"121bjdd1823m"}
});
```
### Stop local only hotspot
Returns stopped as a string.
```js
stopHS().then((isStopped) => {
console.log(isStopped);
});
```
### Connect
```js
connect(ssid: String, pass: String);
```
### Is WiFi On?
```js
isWifiOn().then((b: boolean) => {
if (b) {
console.log('Yes');
} else {
console.log('No');
}
});
```
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT