react-native-kalman-location
Acquires location coordinates via google play services and runs a kalman filter on the stream of updates.
DEMO
Installation
Install the package
yarn add react-native-kalman-location
Link Native Module
react-native link
or do it manually as described below:
Manual Installation: Add it to your android project
- In
android/settings.gradle
...include ':react-native-kalman-location', ':app'project(':react-native-kalman-location').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-kalman-location/android/app')
- In
android/app/build.gradle
...dependencies { ... compile project(':react-native-kalman-location')}
- register module (in MainActivity.java)
React Native
......
Add Permissions and Google API to your Project
Add this to your AndroidManifest file;
// file: android/app/src/main/AndroidManifest.xml
Make sure this goes at the bottom of the <application>
tag.
Example Usage
;; ; type State = latitude: number longitude: number provider: 'gps' | 'kalman' accuracy: number state: State = latitude: 0 longitude: 0 provider: '' accuracy: 0 ; { // Register Listener Callback - has to be removed later thisevEmitter = DeviceEventEmitter; // Initialize RNKalmanLocation to start emiting location RNKalmanLocation; } { this; } { // Stop listening for Events thisevEmitter; // Stop emiting location, this is required!! RNKalmanLocation; } { return <View style=stylescontainer> <Text style=styleslocation> JSON </Text> </View> ; } var styles = StyleSheet; AppRegistry;