$ npm install react-native-weward-android-pedometer --save
$ react-native link react-native-weward-android-pedometer
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.weward.pedometer.RNWewardAndroidPedometerPackage;
to the imports at the top of the file - Add
new RNWewardAndroidPedometerPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-weward-android-pedometer' project(':react-native-weward-android-pedometer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-weward-android-pedometer/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-weward-android-pedometer')
import RNWewardAndroidPedometer from 'react-native-weward-android-pedometer';
//Starts step service
RNWewardAndroidPedometer.startStepService();
//Stops step service
RNWewardAndroidPedometer.stopStepService();