2.0.7 • Published 12 months ago

@doegel/react-native-iot-wifi v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@doegel/react-native-iot-wifi

Connect to WiFi with React Native on Android and iOS. This library was written to config iot devices. With iOS 11 Apple introduced NEHotspotConfiguration class for wifi configuration. Library supports same functionality on ios and android.

Changelog

⚠️ This is a complete rewrite from v1 based on the great work of (tadasr/react-native-iot-wifi)https://github.com/tadasr/react-native-iot-wifi, if you are looking for the old version look here.

2.0.0

Installation

npm install react-native-iot-wifi

iOS

Important IoTWifi uses NEHotspotConfigurationManager. To use the NEHotspotConfigurationManager class, you must enable the Hotspot Configuration capability in Xcode.

  1. Enable Hotspot Configuration
  2. For iOS 12 Enable Access WiFi Information

Usage

import Wifi from "react-native-iot-wifi";

// On some platforms location permission is required to setup wifi.
await Wifi.requestPermission();
let allowed = await Wifi.hasPermission();

// You may check if the API is available.
let available = await Wifi.isApiAvailable();

let ssid = await Wifi.getSSID();

try {
  // without passphrase
  await Wifi.connect("wifi-ssid");

  // with passphrase (only WPA is supported)
  await Wifi.connect("wifi-ssid", "passphrase");
} catch (error) {
  console.log('error: ' + error);
}

try {
  await Wifi.disconnect("wifi-ssid");
} catch (error) {
  console.log('error: ' + error);
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

See the LICENSE file for license rights and limitations (MIT).

2.0.7

12 months ago

2.0.6

12 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago