시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
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.
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.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-pedometerbunx cap sync가져오기
“Import” 섹션import { CapacitorPedometer } from '@capgo/capacitor-pedometer';빠른 시작
“빠른 시작” 섹션import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.requestPermissions();await CapacitorPedometer.startMeasurementUpdates();
await CapacitorPedometer.addListener('measurement', (event) => { updateStepCount(event.numberOfSteps);});예: iOS 히스토리 쿼리
섹션 제목: “예시: iOS 히스토리 쿼리”const sample = await CapacitorPedometer.getMeasurement({ startDate: start.toISOString(), endDate: end.toISOString(),});자주 하는 실수
“흔한 실수” 섹션- 권한: iOS에서의 모션,
ACTIVITY_RECOGNITIONAndroid에서. - 웹: 사용 불가, 웹 빌드에서는 단계 UI 숨김.
- 업데이트 중지: 호출
stopMeasurementUpdates()배터리 절약을 위해.
API 개요
“API 개요” 섹션getMeasurement
“getMeasurement” 섹션지정된 시간 범위 내의 만보계 측정값을 가져옵니다.
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
const result = await CapacitorPedometer.getMeasurement();console.log(result);isAvailable
“isAvailable” 섹션이 기기에서 사용 가능한 만보계 기능을 확인합니다.
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
const result = await CapacitorPedometer.isAvailable();console.log(result);startMeasurementUpdates
“startMeasurementUpdates” 섹션실시간 만보계 측정 업데이트를 받기 시작합니다.
웹 Android 및 iOS, measurement 호출한 후에만 이벤트가 발생합니다 startMeasurementUpdates().
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.startMeasurementUpdates();stopMeasurementUpdates
“stopMeasurementUpdates” 섹션실시간 만보계 측정 업데이트 수신을 중단합니다.
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
await CapacitorPedometer.stopMeasurementUpdates();checkPermissions
“checkPermissions” 섹션만보계 데이터 접근 권한을 확인합니다.
웹 Android, 이 코드는 ACTIVITY_RECOGNITION 권한.
iOS, 이 코드는 모션 사용 권한을 확인합니다.
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
const result = await CapacitorPedometer.checkPermissions();console.log(result);requestPermissions
“requestPermissions” 섹션만보기 데이터 접근 권한을 요청합니다.
웹 Android, 이는 ...을 요청합니다 ACTIVITY_RECOGNITION 권한.
iOS에서는 모션 사용 권한을 요청합니다.
import { CapacitorPedometer } from '@capgo/capacitor-pedometer';
const result = await CapacitorPedometer.requestPermissions();console.log(result);타입 레퍼런스
“타입 참조” 섹션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
“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;Source of Truth
“Source Of Truth” 섹션이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.
시작하기 다음 단계
“Getting Started에서 계속하기” 섹션사용 중이라면 시작하기 대시보드 및 API 운영을 계획하려면, 이를 다음과 연결하세요 @capgo/capacitor-pedometer 사용하기 @capgo/capacitor-pedometer 사용하기에서 네이티브 기능을 위해, API 개요 구현 세부 사항은 API 개요에서 소개 구현 세부 사항은 소개에서 API 키 API Keys의 구현 세부 사항은, 기기 Devices의 구현 세부 사항은.