npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-network-signal-strength

v1.0.2

Published

Apache cordova plugin to detect network signal strength and other network updates such as network types and connection state

Downloads

82

Readme

cordova-plugin-network-signal-strength

Apache cordova plugin to detect network signal strength and other network updates such as network types and connection state

Supported Platforms

Android

Installation

from npm repo: $ cordova plugin add cordova-plugin-network-signal-strength

or from git repo: $ cordova plugin add https://github.com/code-flag/cordova-plugin-network-signal-strength.git

Usage

The API has only one method window["networkSignalStrength"].networkInfo(infoType, callback).

  • infoType parameter could either be:
    • null : to get all the network details including signal strength, network type and connection state
    • CONNECTION_STATE : to get only the connection state which will return 0 or 1.
      • 0 : disconnected
      • 1 : connected
    • SIGNAL_STRENGTH : to get only the signal strength information.
      • This return an object which include *** rssi, rssq, rssnr, rsrp, signal level and lte level ***
          const signalTypeRange = {
           RSSI: [-113, -51, "dBm"],
           RSSNR: [-20, +30, "dB"],
           RSRQ: [-34, 3, "dB"],
           RSRP: [-140, -43, "dBm"],
           };
    • NETWORK_TYPE : to get type of connected network. Return integer -1 to 4
      • -1 : unknown
      • 0 : disconnected
      • 1 : wifi
      • 2 : 2g
      • 3 : 3g
      • 4 : 4g
      • 5 : roaming
    code snippet
       window['networkSignalStrength']?.networkInfo(null, (networkInfoData) => {
       console.log('network signal data :', networkInfoData)
       });
  • You receive -1 as a result if the device is unable to get a known network type and 0 for offline or disconnected state.
   window['networkSignalStrength']?.networkInfo(SIGNAL_STRENGTH, (networkInfoData) => {
   console.log('network signal data :', networkInfoData)
   });
  • You should call the window.SignalStrength.dbm only after cordova platform is ready. Example in Ionic framework:
  // ensure platform is ready before calling the plugin method
  $ionicPlatform.ready().then(() => {
    // Platform now ready, execute any required native code
    setInterval(() => {
      window['networkSignalStrength']?.networkInfo(null, (networkInfoData) => {console.log('network signal data :', networkInfoData)});
    }, 5000)
  });

Notes

  • window['networkSignalStrength'] is undefined when testing your app on your PC while using ionic serve.
  • when you call window['networkSignalStrength'].networkInfo for the first time the device may respond with -1 or 0. Try calling the function again after some delay.

How to Contribute

Use pull request.