Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 854 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 854 Bytes

react-native-pedometer

react native module to count steps

Installation

npm install react-native-pedometer-ios-android

Usage

import Pedometer from "react-native-pedometer";

// ...

Pedometer.isSupported().then((result) => {
      if (result) {
        console.log('Sensor TYPE_STEP_COUNTER is supported on this device');

        const myModuleEvt = new NativeEventEmitter(NativeModules.Pedometer);
        myModuleEvt.addListener('StepCounter', (data) => {
          console.log('STEPS', data.steps);
        });

        Pedometer.startStepCounter();
      } else {
        console.log('Sensor TYPE_STEP_COUNTER is not supported on this device');
      }
    });

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT