https://github.com/j0nl1/rnative-sensor-manager
https://github.com/j0nl1/rnative-sensor-manager
acceloremeter android gyroscope magnetometer react-native rnative-sensor-manager thermometer
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/j0nl1/rnative-sensor-manager
- Owner: j0nl1
- License: mit
- Created: 2020-12-15T01:45:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-08T21:16:04.000Z (over 4 years ago)
- Last Synced: 2025-03-16T22:11:58.007Z (7 months ago)
- Topics: acceloremeter, android, gyroscope, magnetometer, react-native, rnative-sensor-manager, thermometer
- Language: Kotlin
- Homepage:
- Size: 431 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rnative-sensor-manager
This package is a wrapper for using sensor native modules
[](./LICENSE)
[](https://github.com/j0nl1/rnative-sensor-manager/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abug)
[](https://www.npmjs.com/package/rnative-sensor-manager)
[](https://npmcharts.com/compare/rnative-sensor-manager?minimal=true)
[](https://npmcharts.com/compare/rnative-sensor-manager?minimal=true)## Installation
```sh
npm install rnative-sensor-manager
```## Support
This project is under development, you can find the roadmap in github projects.
| Platform | Pressure Sensor | Light Sensor | Orientation Sensor| Humidity Sensor| Proximity Sensor| Temperature Sensor | Magnetic Sensor| Step Sensor | Gravity Sensor
| ---------- |:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| Android | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| iOS | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |## API Usage
### Orientation
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startOrientation(100);
DeviceEventEmitter.addListener("orientation", (data) => {
/**
* data.azimuth
* data.pitch
* data.roll
**/
});
SensorManager.stopOrientation();
```### Light
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startLight(100);
DeviceEventEmitter.addListener("light", (data) => {
/**
* data.lux
**/
});
SensorManager.stopLight();
```### Thermometer
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startThermometer(100);
DeviceEventEmitter.addListener("temperature", (data) => {
/**
* data.temperature
**/
});
SensorManager.stopThermometer();
```### Proximity
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startProximity(100);
DeviceEventEmitter.addListener("proximity", (data) => {
/**
* data.proximity
**/
});
SensorManager.stopProximity();
```### Pressure
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startPressure(100);
DeviceEventEmitter.addListener("pressure", (data) => {
/**
* data.pressure
**/
});
SensorManager.stopPressure();
```### Humidity
```js
import SensorManager from "rnative-sensor-manager";
SensorManager.startHumidity(100);
DeviceEventEmitter.addListener("humidity", (data) => {
/**
* data.humidity
**/
});
SensorManager.stopHumidity();
```## Acknowledgements
- [`react-native-sensor-manager`](https://www.npmjs.com/package/react-native-sensor-manager) has been a great source of inspiration for this project.
## License
[MIT](./LICENSE)