npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capgo/capacitor-pedometer

v9.0.0

Published

Capacitor plugin for accessing pedometer data including steps, distance, pace, cadence, and floors

Readme

@capgo/capacitor-pedometer

Count steps in your Capacitor app with the device motion sensors: live step updates and history queries for fitness, health and challenge apps.

🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use @capgo/capacitor-pedometer in your Capacitor app: npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-pedometer to my Capacitor app and wire it up." Agent setup guides · Hosted MCP

Built and maintained with AI

We build, improve and fix our plugins with heavy use of AI, so issues usually get fixed in under a day and pull requests get feedback the same day. A human still reviews, tests and merges 50+ pull requests daily.

  • Most plugin issues get a fix pull request the same day, often within a couple of hours, and are usually resolved in one to two days.
  • Every pull request goes through our AI review system, usually within minutes.
  • Our AI pre-checks tests, code review, conventions and security, then a human reviews, tests and merges.
  • A human, Martin, reviews, tests and merges 50+ pull requests every day.
  • In the last 90 days, 95% of plugin issues were resolved.

Learn more about how we build with AI

Key features

  • Live updates: startMeasurementUpdates() streams the measurement event, stopMeasurementUpdates() ends it.
  • History on iOS: getMeasurement() returns steps for a time range.
  • Rich data on iOS: distance, pace, cadence and floors ascended or descended from Core Motion.
  • Availability: isAvailable() tells you which metrics the device supports.
  • Permissions: motion permission on iOS and ACTIVITY_RECOGNITION on Android.
  • Platforms: iOS and Android. Android counts steps with the step sensor. Not available on web.

Compatibility

| Plugin version | Capacitor compatibility | Maintained | | -------------- | ----------------------- | ---------- | | v9.*.* | v9.*.* | ✅ | | v8.*.* | v8.*.* | On demand | | v7.*.* | v7.*.* | On demand | | v6.*.* | v6.*.* | ❌ | | v5.*.* | v5.*.* | ❌ |

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v9 for Capacitor 9). Only the latest major version is actively maintained.

Migrating from v8 to v9

v9 of @capgo/capacitor-pedometer targets Capacitor 9. Update Capacitor and this plugin together, then sync the native projects:

npm install @capacitor/core@^9.0.0 @capacitor/cli@^9.0.0 @capacitor/ios@^9.0.0 @capacitor/android@^9.0.0 @capgo/capacitor-pedometer@^9.0.0
npx cap sync

Capacitor 9 needs Node.js 24+, iOS 16+ (Xcode 27) and Android minSdk 26 / compileSdk 37. Follow the official Capacitor 9 update guide for the app side changes.

No plugin API was removed: the JavaScript API of v9 is the same as v8.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-pedometer` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capgo/capacitor-pedometer
npx cap sync

Configuration

iOS

Add the following to your Info.plist:

<key>NSMotionUsageDescription</key>
<string>We need access to your motion data to track steps and activity</string>

Android

The plugin will automatically add the ACTIVITY_RECOGNITION permission to your AndroidManifest.xml.

For Android 10 (API 29) and above, you need to request the ACTIVITY_RECOGNITION permission at runtime.

API

getMeasurement(...)

getMeasurement(options?: GetMeasurementOptions | undefined) => Promise<Measurement>

Get pedometer measurements for a specified time range.

| Param | Type | | ------------- | ----------------------------------------------------------------------- | | options | GetMeasurementOptions |

Returns: Promise<Measurement>

Since: 0.0.1


isAvailable()

isAvailable() => Promise<IsAvailableResult>

Check which pedometer features are available on this device.

Returns: Promise<IsAvailableResult>

Since: 0.0.1


startMeasurementUpdates()

startMeasurementUpdates() => Promise<void>

Start receiving real-time pedometer measurement updates.

On Android and iOS, the measurement event is only fired after calling startMeasurementUpdates().

Since: 0.0.1


stopMeasurementUpdates()

stopMeasurementUpdates() => Promise<void>

Stop receiving real-time pedometer measurement updates.

Since: 0.0.1


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check permission to access pedometer data.

On Android, this checks the ACTIVITY_RECOGNITION permission. On iOS, this checks the motion usage permission.

Returns: Promise<PermissionStatus>

Since: 0.0.1


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Request permission to access pedometer data.

On Android, this requests the ACTIVITY_RECOGNITION permission. On iOS, this requests motion usage permission.

Returns: Promise<PermissionStatus>

Since: 0.0.1


addListener('measurement', ...)

addListener(eventName: 'measurement', listenerFunc: (event: MeasurementEvent) => void) => Promise<PluginListenerHandle>

Called when a new pedometer measurement is received.

| Param | Type | | ------------------ | ----------------------------------------------------------------------- | | eventName | 'measurement' | | listenerFunc | (event: Measurement) => void |

Returns: Promise<PluginListenerHandle>

Since: 0.0.1


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Since: 0.0.1


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

Measurement

| Prop | Type | Description | Since | | ----------------------- | ------------------- | ----------------------------------------------------------------------------------- | ----- | | numberOfSteps | number | The number of steps taken by the user. | 0.0.1 | | distance | number | The estimated distance (in meters) traveled by the user. Only available on iOS. | 0.0.1 | | floorsAscended | number | The approximate number of floors ascended. Only available on iOS. | 0.0.1 | | floorsDescended | number | The approximate number of floors descended. Only available on iOS. | 0.0.1 | | currentPace | number | The current pace (in seconds per meter). Only available on iOS. | 0.0.1 | | currentCadence | number | The current cadence (steps per second). Only available on iOS. | 0.0.1 | | averageActivePace | number | The average active pace (in seconds per meter). Only available on iOS. | 0.0.1 | | startDate | number | The start time of this measurement (milliseconds since epoch). | 0.0.1 | | endDate | number | The end time of this measurement (milliseconds since epoch). | 0.0.1 |

GetMeasurementOptions

| Prop | Type | Description | Since | | ----------- | ------------------- | ----------------------------------------------------------------------------------------- | ----- | | start | number | The start time for the measurement query (milliseconds since epoch). Required on iOS. | 0.0.1 | | end | number | The end time for the measurement query (milliseconds since epoch). Required on iOS. | 0.0.1 |

IsAvailableResult

| Prop | Type | Description | Since | | ------------------- | -------------------- | --------------------------------------------------------------------------------------------------------- | ----- | | stepCounting | boolean | Whether step counting is available. | 0.0.1 | | distance | boolean | Whether distance measurement is available. Only true on iOS devices that support distance tracking. | 0.0.1 | | pace | boolean | Whether pace measurement is available. Only true on iOS devices that support pace tracking. | 0.0.1 | | cadence | boolean | Whether cadence measurement is available. Only true on iOS devices that support cadence tracking. | 0.0.1 | | floorCounting | boolean | Whether floor counting is available. Only true on iOS devices that support floor tracking. | 0.0.1 |

PermissionStatus

| Prop | Type | Description | Since | | ------------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | | activityRecognition | 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied' | Permission state for activity recognition. On Android, this is the ACTIVITY_RECOGNITION permission. On iOS, this is the motion usage permission. | 0.0.1 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Type Aliases

MeasurementEvent

Measurement

Usage

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';

// Check availability
const availability = await CapacitorPedometer.isAvailable();
console.log('Features available:', availability);

// Check and request permissions
const permission = await CapacitorPedometer.checkPermissions();
if (permission.activityRecognition !== 'granted') {
  await CapacitorPedometer.requestPermissions();
}

// Start real-time updates
await CapacitorPedometer.addListener('measurement', (data) => {
  console.log('Steps:', data.numberOfSteps);
  console.log('Distance:', data.distance);
});

await CapacitorPedometer.startMeasurementUpdates();

// Query historical data (iOS only - requires start and end timestamps)
const now = Date.now();
const yesterday = now - (24 * 60 * 60 * 1000);
const measurement = await CapacitorPedometer.getMeasurement({
  start: yesterday,
  end: now
});

// Stop updates
await CapacitorPedometer.stopMeasurementUpdates();
await CapacitorPedometer.removeAllListeners();

Platform Support

| Feature | Android | iOS | |---------|---------|-----| | Step Counting | ✅ | ✅ | | Distance | ❌ | ✅ | | Pace | ❌ | ✅ | | Cadence | ❌ | ✅ | | Floor Counting | ❌ | ✅ | | Historical Queries | ❌ | ✅ |

Notes

  • On Android, only step counting is available. The plugin uses the TYPE_STEP_COUNTER sensor.
  • On iOS, all features are available on supported devices using CMPedometer.
  • Historical data queries require explicit start and end timestamps on iOS.
  • Android's step counter gives cumulative steps since last device reboot; the plugin tracks the delta.
  • Measurements are paused when the app is in the background.

License

MIT