Global

Members

(constant) StepCounter

A module that allows you to get the step count data. CMStepCounter is deprecated in iOS 8.0. Used CMPedometer instead.

Properties:
Name Type Description
floorsAscended number

The number of floors ascended during the time period. iOS Only.

floorsDescended number

The number of floors descended during the time period. iOS Only.

counterType string

The type of counter used to count the steps.

Source:
Example
import { StepCounter } from '@dongminyu/react-native-step-counter';

(constant) isTurboModuleEnabled

We keep TurboModuleManager alive until the JS VM is deleted. It is perfectly valid to only use/create TurboModules from JS. In such a case, we shouldn't de-alloc TurboModuleManager if there aren't any strong references to it in ObjC. Hence, we give __turboModuleProxy a strong reference to TurboModuleManager.

Source:
See:

Methods

isStepCountingSupported() → {Promise.<Record.<string, boolean>>}

Returns whether the stepCounter is enabled on the device. iOS 8.0+ only. Android is available since KitKat (4.4 / API 19).

Properties:
Name Type Description
supported boolean

Whether the stepCounter is supported on device.

granted boolean

Whether user granted the permission.

Source:
See:
Returns:

A promise that resolves with an object containing the stepCounter availability.

Type
Promise.<Record.<string, boolean>>

parseStepData(data) → {ParsedStepCountData}

Transform the step count data into a more readable format. You can use it or directly use the StepCountData type.

Parameters:
Name Type Description
data StepCountData

Step Counter Sensor Event Data.

Source:
Returns:
  • String Parsed Count Data.
Type
ParsedStepCountData

startStepCounterUpdate(start, callBack) → {Subscription}

Start to subscribe stepCounter updates. 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.

iOS

CMStepCounter.startStepCountingUpdates is deprecated since iOS 8.0. so used CMPedometer.startUpdates instead.

Parameters:
Name Type Description
start Date

A date indicating the start of the range over which to measure steps.

callBack StepCountUpdateCallback

This callback function makes it easy for app developers to receive sensor events.

Source:
See:
Returns:
  • Returns a Subscription that enables you to call. When you would like to unsubscribe the listener, just use a method of subscriptions's remove().
Type
Subscription
Example
const startDate = new Date();
startStepCounterUpdate(startDate).then((response) => {
   const data = parseStepCountData(response);
})

stopStepCounterUpdate()

Stop the step counter updates.

iOS

CMStepCounter.stopStepCountingUpdates is deprecated since iOS 8.0. so used CMPedometer.stopUpdates instead.

Source:
See:

Type Definitions

StepCountData

StepCountData is an object with four properties: distance, steps, startDate, and endDate.

Properties:
Name Type Description
counterType string

The type of counter used to count the steps.

steps number

The number of steps taken during the time period.

startDate number

The start date of the data.

endDate number

The end date of the data.

distance number

The distance in meters that the user has walked or run.

floorsAscended number | undefined

number of floors ascended (iOS only)

floorsDescended number | undefined

number of floors descended (iOS only)

Source: