Close

Pedometer

Use Core Motion (iOS) or Google Fit (Android) to get the user’s step count.

Expo.Pedometer.isAvailableAsync()

Determine whether the pedometer is available.

Returns

  • A boolean indicating whether the pedometer is available on this device.

Expo.Pedometer.getStepCountAsync(start, end)

Get the step count between two dates.

Arguments

  • start (Date) — A date indicating the start of the range over which to measure steps.

  • end (Date) — A date indicating the end of the range over which to measure steps.

Returns

  • A number indicating the number of steps taken between the given dates.

Expo.Pedometer.watchStepCount(callback)

Subscribe to pedometer updates.

Arguments

  • callback (function) A callback that is invoked when new step count data is available. The callback is provided a single argument that is an object with a steps key.

Returns

  • An EventSubscription object that you can call remove() on when you would like to unsubscribe the listener.