I'm setting up a Pedometer app in React Native using Expo, testing the code on my real Samsung s10 device.
I am using the Expo Pedometer documentation
However, when I use the Pedometer.getStepCountAsync
method, I get returned an error "Getting step count for date range is not supported on Android yet."
I am trying to make a pedometer app that reads users steps, and then puts them into some visuals for the user but I can't get the steps data.
My code is below: it reaches the error => line and returns the error mentioned above. :(
I've enabled the Fitness API in my Google Developer Console and am 99% sure I have the right credentials; as I have used the Google Login successfully in the same app.
const end = new Date();
const start = new Date();
start.setDate(end.getDate() - 1);
Pedometer.getStepCountAsync(start, end).then(
result => {
this.setState({ pastStepCount: result.steps });
},
error => {
this.setState({
pastStepCount: "Could not get stepCount: " + error
});
}
);
I guess the expected result is that I get the user's steps from the past day in the result but instead I get the error that it is not supported on android.