__CAPGO_KEEP_0__
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-device-info`
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/device-info/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-device-info` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르시오:
bun add @capgo/capacitor-device-infobunx cap syncImport
제목이 “Import”인 섹션import { DeviceInfo } from '@capgo/capacitor-device-info';한 번의 스냅샷 읽기
제목이 “Read One Snapshot”인 섹션const snapshot = await DeviceInfo.getInfo();
console.log(snapshot.cpu.cores);console.log(snapshot.memory.usedPercent);console.log(snapshot.storage.freeBytes);console.log(snapshot.sensors?.pressureHpa);cpu.usagePercent delta-based입니다. 첫 번째 네이티브 샘플에서는 생략할 수 있지만, 두 번째 샘플 이후에 CPU 사용률이 채워진 값을 받으려면 다시 호출하거나 모니터링을 사용하시길 바랍니다. getInfo __CAPGO_KEEP_0__
실시간 업데이트
실시간 업데이트 섹션const handle = await DeviceInfo.addListener('deviceInfoUpdate', (sample) => { console.log(sample.sequence, sample.elapsedMs); console.log(sample.cpu.usagePercent); console.log(sample.sensors?.readings);});
await DeviceInfo.startMonitoring({ intervalMs: 1000, emitImmediately: true,});업데이트 중지
업데이트 중지 섹션await DeviceInfo.stopMonitoring();await handle.remove();자동으로도 중지할 수 있습니다.
await DeviceInfo.startMonitoring({ intervalMs: 1000, durationMs: 60_000, sampleCount: 60,});모니터링 상태 확인
모니터링 상태 확인 섹션const state = await DeviceInfo.isMonitoring();
if (state.monitoring) { console.log(state.samplesEmitted);}센서 필드 온보딩
센서 field를 등록하는 방법const { sensors, cpu, gpu } = await DeviceInfo.getInfo();
console.log(cpu.temperatureCelsius);console.log(gpu?.temperatureCelsius);console.log(sensors?.batteryTemperatureCelsius);console.log(sensors?.ambientTemperatureCelsius);console.log(sensors?.relativeHumidityPercent);console.log(sensors?.pressureHpa);console.log(sensors?.illuminanceLux);console.log(sensors?.proximityDistanceCm);console.log(sensors?.availableSensors);센서 field는 선택적입니다. 기기, OS, 앱 sandbox가 노출하는 metric이 있을 때만 존재합니다.
플랫폼 Notes
플랫폼 Notes- iOS는 노출된 metric에 대한 권한이 필요하지 않습니다. CoreMotion sensor 가용성만 보고하지만 raw CPU 또는 GPU 온도는 보고하지 않습니다.
- Android는 노출된 metric에 대한 권한이 필요하지 않습니다. CPU 및 GPU 온도는 best-effort thermal-zone 읽기입니다.
- 웹 지원은 best effort이며 브라우저가 native device sensor를 일관되게 노출하지 않기 때문에 onboard sensor array가 empty로 보고됩니다.
타입 참조
타입 참조DeviceInfoSnapshot
DeviceInfoSnapshotexport interface DeviceInfoSnapshot { timestamp: number; platform: 'ios' | 'android' | 'web'; cpu: CpuInfo; memory: MemoryInfo; storage: StorageInfo; gpu?: GpuInfo; thermalState?: ThermalState; lowPowerMode?: boolean; sensors?: OnboardSensorsInfo;}OnboardSensorsInfo
센서 정보 등록export interface OnboardSensorsInfo { availableSensors?: OnboardSensorDescriptor[]; readings?: OnboardSensorReading[]; batteryTemperatureCelsius?: number; ambientTemperatureCelsius?: number; relativeHumidityPercent?: number; pressureHpa?: number; illuminanceLux?: number; proximityDistanceCm?: number;}MonitoringOptions
모니터링 옵션export interface MonitoringOptions { intervalMs?: number; durationMs?: number; sampleCount?: number; emitImmediately?: boolean;}실제 데이터 원천
실제 데이터 원천이 페이지는 플러그인의 src/definitions.tsAPI이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속__CAPGO_KEEP_0__이 업스트림에서 변경될 때 다시 싱크를 실행하세요. Getting Started에서 시작합니다. __CAPGO_KEEP_0__의 장치 진단을 위해 연결하세요. @capgo/capacitor-device-info __CAPGO_KEEP_0__의 개요를 위해 @capgo/capacitor-device-info를 사용하세요. __CAPGO_KEEP_0__의 튜토리얼을 위해 @capgo/capacitor-barometer __CAPGO_KEEP_0__의 집중된 압력 읽기를 위해 @capgo/capacitor-light-sensor __CAPGO_KEEP_0__의 집중된 조도 센서 읽기를 위해.