React-native pedometer for IOS and Android
Branch: master
Clone or download
Latest commit ba7081c Oct 24, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android Fix android callbacks Dec 26, 2017
ios calibrate sensivity Mar 1, 2018
.gitignore Inicia o projeto Aug 17, 2016
README.md Fix readme Dec 26, 2017
index.js stopPedometerUpdates Feb 20, 2018
package.json Update package.json Oct 24, 2018
prettier.config.js Beautify code Dec 25, 2017

README.md

react-native-universal-pedometer

React Native pedometer support for iOS version 8.0 and higher and Android. The module is CMPedometer wrapper. More info about CMPedometer can be found in https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CMPedometer_class/

Basic usage

// Import the react-native-pedometer module
import Pedometer from 'react-native-universal-pedometer';

// determine pedometer availability
Pedometer.isStepCountingAvailable((error, isAvailable) => {
  // do something
});

Pedometer.isDistanceAvailable((error, isAvailable) => {
  // do something
});

Pedometer.isFloorCountingAvailable((error, isAvailable) => {
  // do something
});

Pedometer.isCadenceAvailable((error, isAvailable) => {
  // do something
});

// start tracking from current time
const now = new Date();
Pedometer.startPedometerUpdatesFromDate(now.getTime(), (pedometerData) => {
  // do something with pedometer data
});

// query pedometer data from selected date to other selected date
const startDate = new Date();
startDate.setHours(0,0,0,0);
const endDate = new Date();
Pedometer.queryPedometerDataBetweenDates(startDate.getTime(), endDate.getTime(), (pedometerData) => {
  // do something with pedometer data
});

// stop pedometer updates
Pedometer.stopPedometerUpdates();