Pedometer Component


Properties

distance
  Returns the approximate distance traveled in meters.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = pedometerName.distance

elapsedTime
  Returns the time elapsed in milliseconds since the pedometer has started.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = pedometerName.elapsedTime

simpleSteps
  Returns the number of simple steps taken since the pedometer has started.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = pedometerName.simpleSteps

stopDetectionTimeout
  Returns the duration of idleness (no steps detected) after which to go into a "stopped" state.
Data type: number
Designer Writable true <pedometer name="pedometerName" stopDetectionTimeout="0">
Code Writeable true pedometerName.stopDetectionTimeout = 0
Code Readable true let variable = pedometerName.stopDetectionTimeout

strideLength
  Returns the current estimate of stride length in meters, if calibrated, or returns the default (0.73 m) otherwise.
Data type: number
Designer Writable true <pedometer name="pedometerName" strideLength="0">
Code Writeable true pedometerName.strideLength = 0
Code Readable true let variable = pedometerName.strideLength

walkSteps
  Returns the number of walk steps taken since the pedometer has started.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = pedometerName.walkSteps

class
  The styling class of the the component
Data type: string
Designer Writable true <pedometer name="pedometerName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <pedometer name="pedometerName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <pedometer name="pedometerName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
reset Resets the step counter, distance measure and time running.
pedometerName.reset()
save Saves the pedometer state to the phone. Permits permits accumulation of steps and distance between invocations of an App that uses the pedometer. Different Apps will have their own saved state.
pedometerName.save()
start Starts the pedometer.
pedometerName.start()
stop Stops the pedometer.
pedometerName.stop()
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
simpleStep This event is run when a raw step is detected.
pedometerName.addEventListener(
    "simpleStep",
    function (simpleSteps, distance) {
        //Your code here
    }
)
simpleSteps number
distance number
walkStep This event is run when a walking step is detected. A walking step is a step that appears to be involved in forward motion.
pedometerName.addEventListener(
    "walkStep",
    function (walkSteps, distance) {
        //Your code here
    }
)
walkSteps number
distance number