0.0.7 • Published 7 years ago

pavex-react-native-wifi-manager v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Wifi manager for React Native

Wifi manager oriented for scanning existing networks. This supports list with scan and wifi enable checking and enabler. This plugin now available for Android only.

Installation

npm install --save pavex-react-native-wifi-manager

Methods

WifiManager.getScanResults();

Retrieves a list of the available networks as an array of objects. Returned the following list structure:

scanResult = [
    {   
        "SSID": ssid,                 // SSID as string
        "BSSID": bssid,               // MAC address of WiFi router as string
        "capabilities": capabilities, // Describes the authentication, etc.
        "frequency": frequency,       // frequency of the access point channel in MHz
        "rssi": rssi_level,           // Raw RSSI value
        "level": signal_level         // RSSI value in percent
    },
    {
        ...
    }
];

WifiManager.startScan();

Call before getWifiList to retrieves current list of available networks.

WifiManager.isEnabled();

Retrieves the current wifi status and passes true or false over Promise.

WifiManager.setEnabled(enabled);

Enable or disable wifi service.

Examples

Check if wifi service is enabled.

WifiManager.isEnabled()
  .then((enabled) => {
    console.log('Wifi is enabled.');
  })
  .catch((error) => {
    console.warn(error);
  });

Scan available wifi networks

WifiManager.startScan()
  .then((scanned) => {
     WifiManager.getScanResults()
       .then((scanResult) => {
         console.log(scanResult);
       })
       .catch((error) => {
         console.warn(error);
       });
    })
    .catch((error) => {
      console.warn(error);
    });
0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago