Getting Started
このプラグインのインストール手順と全マークダウンガイドのコピー用の設定プロンプトをコピーする。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-pedometer`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/pedometer/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクション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.__CAPGO_KEEP_0__の手動セットアップを選択する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム固有の説明を参照してください:
bun add @capgo/capacitor-pedometerbunx cap syncインポート
「インポート」のセクションimport { CapacitorPedometer } from '@capgo/capacitor-pedometer';APIの概要
「APIの概要」のセクションgetMeasurement
「getMeasurement」のセクション指定された時間範囲で歩数計の測定値を取得します。
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.getMeasurement();isAvailable
「isAvailable」のセクションこのデバイスで利用可能な歩数計の機能を確認します。
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.isAvailable();startMeasurementUpdates
startMeasurementUpdatesリアルタイム歩数計測値の更新を受け始めます。
オン Android と iOS、イベントは measurement Copy to clipboard startMeasurementUpdates().
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.startMeasurementUpdates();stopMeasurementUpdates
クリップボードにコピーリアルタイム歩数計測データの更新を停止します。
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.stopMeasurementUpdates();checkPermissions
checkPermissionsセクション歩数計測データへのアクセス許可を確認します。
オン Androidこの ACTIVITY_RECOGNITION 許可を確認します。
オン iOSこの動作使用許可を確認します。
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.checkPermissions();requestPermissions
requestPermissionsセクション__CAPGO_KEEP_0__を歩数データにアクセスするための許可を求めます。
On Androidで、この ACTIVITY_RECOGNITION 許可を求めます。
On iOSで、この
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.requestPermissions();__CAPGO_KEEP_0__をクリップボードにコピー
Type ReferenceGetMeasurementOptions
「Type Reference」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
IsAvailableResultセクション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;}PermissionStatus
PermissionStatusセクション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';}MeasurementEvent
MeasurementEventセクションexport type MeasurementEvent = Measurement;真実の源
真実の源セクションこのページはプラグインから生成されています。 src/definitions.ts. upstreamのpublic APIが変更されたときに再度syncを実行してください。
Getting Startedから続けて
Getting Startedから続けてCapgoを使用している場合 Getting Started ダッシュボードとAPIの操作を計画するには、Capgoを Capgoの@capgo/capacitor-pedometer Capgoの@capgo/capacitor-pedometer APIの概要 APIの概要 導入 導入 APIのキー APIの実装詳細については、キーや デバイス __CAPGO_KEEP_0__の実装詳細については、デバイスについて