Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
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.
Install
Section titled “Install”bun add @capgo/capacitor-device-infobunx cap syncImport
Section titled “Import”import { DeviceInfo } from '@capgo/capacitor-device-info';Read One Snapshot
Section titled “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 is delta-based. The first native sample can omit it; call getInfo again later or use monitoring to receive populated CPU usage after the second sample.
Stream Updates
Section titled “Stream Updates”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,});Stop Updates
Section titled “Stop Updates”await DeviceInfo.stopMonitoring();await handle.remove();You can also stop automatically:
await DeviceInfo.startMonitoring({ intervalMs: 1000, durationMs: 60_000, sampleCount: 60,});Check Monitoring State
Section titled “Check Monitoring State”const state = await DeviceInfo.isMonitoring();
if (state.monitoring) { console.log(state.samplesEmitted);}Onboard Sensor Fields
Section titled “Onboard Sensor Fields”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);Sensor fields are optional. They are present only when the device, OS, and app sandbox expose that metric.
Platform Notes
Section titled “Platform Notes”- iOS requires no permissions for the exposed metrics. It reports CoreMotion sensor availability but not raw CPU or GPU temperature.
- Android requires no permissions for the exposed metrics. CPU and GPU temperatures are best-effort thermal-zone reads.
- Web support is best effort and reports empty onboard sensor arrays because browsers do not expose native device sensors consistently.
Type Reference
Section titled “Type Reference”DeviceInfoSnapshot
Section titled “DeviceInfoSnapshot”export interface DeviceInfoSnapshot { timestamp: number; platform: 'ios' | 'android' | 'web'; cpu: CpuInfo; memory: MemoryInfo; storage: StorageInfo; gpu?: GpuInfo; thermalState?: ThermalState; lowPowerMode?: boolean; sensors?: OnboardSensorsInfo;}OnboardSensorsInfo
Section titled “OnboardSensorsInfo”export interface OnboardSensorsInfo { availableSensors?: OnboardSensorDescriptor[]; readings?: OnboardSensorReading[]; batteryTemperatureCelsius?: number; ambientTemperatureCelsius?: number; relativeHumidityPercent?: number; pressureHpa?: number; illuminanceLux?: number; proximityDistanceCm?: number;}MonitoringOptions
Section titled “MonitoringOptions”export interface MonitoringOptions { intervalMs?: number; durationMs?: number; sampleCount?: number; emitImmediately?: boolean;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.
Keep going from Getting Started
Section titled “Keep going from Getting Started”If you are using Getting Started for device diagnostics, connect it with @capgo/capacitor-device-info for the overview, Using @capgo/capacitor-device-info for a tutorial, @capgo/capacitor-barometer for focused pressure readings, and @capgo/capacitor-light-sensor for focused light sensor readings.