コンテンツにジャンプ

Getting Started

GitHub

CapgoのAI-Assisted Setupを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください:

ターミナル
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

次に、以下のプロンプトを使用してください:

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

Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください:

ターミナル
bun add @capgo/capacitor-pedometer
bunx cap sync
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';

指定された時間範囲内で歩数計の測定値を取得します。

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.getMeasurement();

このデバイスで利用可能な歩数計の機能を確認します。

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.isAvailable();

__CAPGO_KEEP_0__

イベント AndroidiOSmeasurement イベントは startMeasurementUpdates().

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.startMeasurementUpdates();

stopMeasurementUpdates

測定停止

コピー

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.stopMeasurementUpdates();

checkPermissions

許可確認

歩数データへのアクセス許可を確認する。

On Androidこのチェックは、 ACTIVITY_RECOGNITION 許可を確認します。 OniOS

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.checkPermissions();

クリップボードにコピー

セクションのタイトルは “requestPermissions” 歩数データへのアクセス許可を要求します。このリクエストは ACTIVITY_RECOGNITION の許可を求めています。 iOS で、このリクエストは運動使用許可を求めています。コピー

import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.requestPermissions();

「Type Reference」のセクション

「GetMeasurementOptions」のセクション

GetMeasurementOptions

コピー
export interface GetMeasurementOptions {
/**
* The start time for the measurement query (milliseconds since epoch).
*
* Required on **iOS**.
*
* @since 0.0.1
*/
start?: number;
/**
* The end time for the measurement query (milliseconds since epoch).
*
* Required on **iOS**.
*
* @since 0.0.1
*/
end?: number;
}

Measurement

コピー
export interface Measurement {
/**
* The number of steps taken by the user.
*
* @since 0.0.1
*/
numberOfSteps?: number;
/**
* The estimated distance (in meters) traveled by the user.
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
distance?: number;
/**
* The approximate number of floors ascended.
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
floorsAscended?: number;
/**
* The approximate number of floors descended.
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
floorsDescended?: number;
/**
* The current pace (in seconds per meter).
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
currentPace?: number;
/**
* The current cadence (steps per second).
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
currentCadence?: number;
/**
* The average active pace (in seconds per meter).
*
* Only available on **iOS**.
*
* @since 0.0.1
*/
averageActivePace?: number;
/**
* The start time of this measurement (milliseconds since epoch).
*
* @since 0.0.1
*/
startDate?: number;
/**
* The end time of this measurement (milliseconds since epoch).
*
* @since 0.0.1
*/
endDate?: number;
}

IsAvailableResult

__CAPGO_KEEP_0__
export interface IsAvailableResult {
/**
* Whether step counting is available.
*
* @since 0.0.1
*/
stepCounting: boolean;
/**
* Whether distance measurement is available.
*
* Only `true` on **iOS** devices that support distance tracking.
*
* @since 0.0.1
*/
distance: boolean;
/**
* Whether pace measurement is available.
*
* Only `true` on **iOS** devices that support pace tracking.
*
* @since 0.0.1
*/
pace: boolean;
/**
* Whether cadence measurement is available.
*
* Only `true` on **iOS** devices that support cadence tracking.
*
* @since 0.0.1
*/
cadence: boolean;
/**
* Whether floor counting is available.
*
* Only `true` on **iOS** devices that support floor tracking.
*
* @since 0.0.1
*/
floorCounting: boolean;
}
export interface PermissionStatus {
/**
* Permission state for activity recognition.
*
* On **Android**, this is the `ACTIVITY_RECOGNITION` permission.
* On **iOS**, this is the motion usage permission.
*
* @since 0.0.1
*/
activityRecognition: 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';
}
export type MeasurementEvent = Measurement;

このページはプラグインの src/definitions.ts公開 API がアップストリームで変更された場合に再度同期を実行してください。

「はじめから始める」から続けて

「はじめから始める」から続けて

Cloudflare、Capacitor、GitHub、Capgo、code、API、SDK、CLI、npm、bun を使用している場合 スタート APIを使用してダッシュボードとAPIの運用を計画し、 @capgo/capacitor-pedometerを使用する for the native capability in Using @capgo/capacitor-pedometer, for the implementation detail in API Overview, for the implementation detail in API Overview, for the implementation detail in Introduction, __CAPGO_KEEP_0__のキー for the implementation detail in API Keys, and for the implementation detail in API Keys, and for the implementation detail in Devices. __CAPGO_KEEP_0__を使用してダッシュボードと__CAPGO_KEEP_0__の運用を計画し、__CAPGO_KEEP_0__と接続する