This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo Pedometer
A library that provides access to the device's pedometer sensor.
Pedometer from expo-sensors uses the system hardware.Sensor on Android and Core Motion on iOS to get the user's step count, and also allows you to subscribe to pedometer updates.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
API
import { Pedometer } from 'expo-sensors';
Methods
Checks user's permissions for accessing pedometer.
Promise<PermissionResponse>Get the step count between two dates.
Promise<PedometerResult>Returns a promise that fulfills with a PedometerResult.
As Apple documentation states:
Only the past seven days worth of data is stored and available for you to retrieve. Specifying a start date that is more than seven days in the past returns only the available data.
Returns whether the pedometer is enabled on the device.
Promise<boolean>Returns a promise that fulfills with a boolean, indicating whether the pedometer is
available on this device.
Asks the user to grant permissions for accessing pedometer.
Promise<PermissionResponse>Subscribe to pedometer updates.
EventSubscriptionReturns a Subscription that enables you to call
remove() when you would like to unsubscribe the listener.
Pedometer updates will not be delivered while the app is in the background. As an alternative, on Android, use another solution based on
Health Connect API. On iOS, thegetStepCountAsyncmethod can be used to get the step count between two dates.
Interfaces
A subscription object that allows to conveniently remove an event listener from the emitter.
Types
Callback function providing event result as an argument.
void
Literal type: union
Permission expiration time. Currently, all permissions are granted permanently.
Acceptable values are: 'never' | number