🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

cordova-plugin-wifi-manager

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-wifi-manager

Wi-Fi Manager Plugin for Apache Cordova

0.5.0
latest
Version published
Weekly downloads
10
-78.26%
Maintainers
1
Weekly downloads
 
Created

cordova-plugin-wifi-manager

GitHub license npm version GitHub Actions

Wi-Fi Manager Plugin for Apache Cordova

Supported Platforms

  • Android: 5.0 or later
  • iOS: 11.0 or later

Installation

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.

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

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

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

cordova-plugin-wifi-manager is available under the MIT license. See the LICENSE file for details.

FAQs

Package last updated on 06 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts