Why does the Pedometer only expose step count? Can we update to return all CMPedometerData fields?

Please provide the following:

  1. SDK Version: 35
  2. Platforms(Android/iOS/web/all): iOS

CMPedometerData exposes a few other fields that would be incredibly valuable to a lot of devs, including distance and currentPace. Why did we choose to limit this to just number of steps?

Hey @kevinwalsh23,

When we authored the module we likely went for core functionality to be able to get it out in a timely manner for release. I would recommend creating a feature request to expose these additional fields on our Canny Board.


1 Like

Hey @adamjnav,

Thanks for the response. Created the ticket here: https://expo.canny.io/feature-requests/p/update-pedometer-to-return-all-cmpedometerdata-fields.

Updating should be as simple as changing this file, ‘https://github.com/expo/expo/blob/1844c78d3815558378f201c78554598968e24773/ios/versioned-react-native/ABI35_0_0/EXSensors/ABI35_0_0EXSensors/Modules/ABI35_0_0EXPedometer.m’, and changing ‘body:@{@“steps”: pedometerData.numberOfSteps}]’ to just '‘body:@{@“pedometerData”: pedometerData}]’ and ‘resolve(@{@“steps”: pedometerData.numberOfSteps});’ to ‘resolve(@{@“pedometerData”: pedometerData});’.


1 Like

@adamjnav sorry for doing this, but…
Can you take a look in my case?

@adamjnav If I submitted a pull request for the feature change, would you be able to review this week and merge?

Could go about it in three ways, let me know what Expo prefers.

  1. Alter the current Pedometer module, exposing all of the fields. (May alter applications currently using the Pedometer as is)

  2. Alter the current Pedometer to return number of steps in the same manner (applications currently using this module will be unaffected), but also include the other fields in a similar fashion.

  3. Create a new Module that returns all of the fields, and leaves the current Pedometer unchanged.

Let me know! Very close to finishing an application that requires this, so glad to just get this work done.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.