Getting the pedometer plugin to fetch data


Hello! I’m trying to make the Pedometer Plugin fetch data from the last week (broken down day-by-day) in order to store it visually as a bar chart.

I am able to make the pedometer work in its most basic form, but it resets every time I restart the app.

I have tried to use the successHandler functionality in the GitHub repo for this plugin and my constructor code looks like this:

var successHandler = function (pedometerData) {
    // pedometerData.startDate; -> ms since 1970
    // pedometerData.endDate; -> ms since 1970
    // pedometerData.numberOfSteps;
    // pedometerData.distance;
    // pedometerData.floorsAscended;
    // pedometerData.floorsDescended;

    // Begin pedometer tracking:
this.pedometer.startPedometerUpdates(successHandler, onError).subscribe((data) => {

        this.steps =  data.numberOfSteps;
        //this.weeklySteps[6] = data.numberOfSteps;
        //this.barChartData  =  [{data: this.weeklySteps}];

However, I’m getting the following errors when I try to run it in its most basic form:

  1. Supplied parameters do not match any signature of call target (in reference to startPedometerUpdates() )

  2. Cannot find name ‘onError’ (understandable since I haven’t defined it anywhere, but it also doesn’t seem to be defined in any example code I’ve seen)

All I want is to display the past week’s step count like all the exercise-tracking apps do! Can anyone nudge me in the right direction? Many thanks!