Fall Detection Library
npm install react-native-fall-detection-moduleFall Detection Library
When using a typical react native sensors library to try to detect a fall, we will need to set the update interval to < 100ms. However, this will cause the react native bridge to be overloaded. As such, the processing of the sensors data cannot be done in the React Native code.
As a solution, this library will only send events through the react native bridge when a fall is detected.
Compatible with android only. If anyone would like to contribute to the IOS version of the code, please feel free to contribute to this project!
``sh`
npm install react-native-fall-detection-module
`js
import {
FallDetectionEmitter,
start,
} from 'react-native-fall-detection-module';
// ...
const [data, setData] = React.useState
React.useEffect(() => {
start();
}, []);
React.useEffect(() => {
FallDetectionEmitter.addListener('fall', (newData: any) => {
console.log(newData);
setData(newData);
// put your data processing step here
});
}, []);
`
Data format being sent when a fall is detected is
```
{"detected" : true}
otherwise no data is being sent
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT