Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

AsserData/react-native-universal-pedometer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/

Install

npm install --save npm i @asserdata/react-native-universal-pedometer
# Or

yarn add @asserdata/react-native-universal-pedometer

Basic usage

// Import the react-native-pedometer module
import Pedometer from '@asserdata/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();

About

React-native pedometer for IOS and Android - WIP 🚧

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 75.9%
  • Objective-C 17.9%
  • JavaScript 6.2%