Skip to content

Simple Wifi manager primary to scanning for React Native mobile applications

Notifications You must be signed in to change notification settings

pavex/react-native-wifi-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);
    });

About

Simple Wifi manager primary to scanning for React Native mobile applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published