cordova-plugin-rssi
Advanced tools
Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "cordova-plugin-rssi", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Cordova plugin for reading WiFi RSSI", | ||
@@ -23,3 +23,5 @@ "main": "index.js", | ||
"cordovaDependencies": { | ||
"0.0.1": { "cordova-ios": ">4.3.0"} | ||
"0.0.1": { | ||
"cordova-ios": ">4.3.0" | ||
} | ||
} | ||
@@ -26,0 +28,0 @@ }, |
# Cordova RSSI Plugin | ||
This plugin allows you to read WiFi RSSI from applications developed using PhoneGap/Cordova 3.0 or newer. | ||
This plugin allows you to read WiFi RSSI from applications developed using Cordova 3.0 or newer. | ||
Works on both Android and iOS platforms, but **will not pass the Apple App Store Review process**. | ||
## Installation | ||
@@ -15,4 +16,58 @@ | ||
## Usage | ||
```js | ||
const rssi = cordova.plugins.rssi; | ||
``` | ||
#### `rssi.read(success, failure)` | ||
Returns the device's current WiFi RSSI information via 3 parameters: | ||
```js | ||
rssi.read(function success(data){ | ||
console.log(data); | ||
// -> {rssi: -38, bars: 4, isIPhoneX: false} | ||
}); | ||
``` | ||
- `rssi`: WiFi Received Signal Strength Indicator | ||
- Availability: Android, iOS but not iPhoneX | ||
- Value: Integer or `null` if unavailable | ||
- Range: `-100 ≤ x ≤ 0` | ||
- `bars`: Number of visible bars in WiFi icon | ||
- Availability: Android, iOS | ||
- Value: Integer | ||
- Range: `0 ≤ x ≤ 4`: <sup>\*Range values only tested for Android</sup> | ||
- `4`: RSSI `-55+` | ||
- `3`: RSSI `-56` - `-66` | ||
- `2`: RSSI `-67` - `-77` | ||
- `1`: RSSI `-78` - `-88` | ||
- `0`: RSSI `-89-` | ||
- `isIPhoneX`: Flag for detecting whether iPhone X acquisition was used | ||
- Availability: Android, iOS | ||
- Value: Boolean | ||
## Browser / Development Usage | ||
While developing in browser, a mock can be utilized to prevent errors. See an example Ionic 4 app at [emcniece/ionic-cordova-rssi-demo](https://github.com/emcniece/ionic-cordova-rssi-demo). | ||
## References | ||
- [Android RSSI-to-bar formula](https://android.stackexchange.com/a/176325) | ||
- [Android WifiManager class](https://github.com/eldarerathis/android_frameworks_base/blob/eldarerathis-7.1.x/wifi/java/android/net/wifi/WifiManager.java#L633) | ||
- [iOS iPhone X Detection](https://stackoverflow.com/a/47566231/943540) | ||
## Attribution | ||
This open-source project was made possible by some fine people over at [CNY Apps](http://cnyapps.com/). | ||
## Licence ## | ||
The MIT License | ||
[The MIT License](./LICENSE) |
Sorry, the diff of this file is not supported yet
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
16512
9
94
1
73
0