@capgo/capacitor-device-info を使用します
Read CPU, memory, GPU, storage, thermal, low-power, and onboard sensor metrics from a Capacitor app.
互換性
このプラグインは Capacitor 8 またはそれ以降が必要です (@capacitor/core >=8.0.0).
インストール
npm install @capgo/capacitor-device-info
npx cap sync
このプラグインが公開するもの
getInfo- CPU、メモリ、GPU、ストレージ、熱管理状態、低消費電力モード、およびオンボードセンサーの 1 つのスナップショットを読み取ります。startMonitoring- チャートと診断ダッシュボード用の周期的なスナップショットを開始します。stopMonitoring- アクティブなストリームを停止します。isMonitoring- ストリームのステータスと発行されたサンプル数を確認します。removeAllListeners- プラグインに登録されたすべてのリスナーを削除します。deviceInfoUpdate-
Listener event emitted for each periodic sample.
import { DeviceInfo } from '@capgo/capacitor-device-info';
const snapshot = await DeviceInfo.getInfo();
console.log(snapshot.cpu.cores);
console.log(snapshot.memory.usedPercent);
console.log(snapshot.gpu?.renderer);
console.log(snapshot.sensors?.pressureHpa);
Example usage
import { DeviceInfo } from '@capgo/capacitor-device-info';
const samples: number[] = [];
const handle = await DeviceInfo.addListener('deviceInfoUpdate', (sample) => {
if (typeof sample.cpu.usagePercent === 'number') {
samples.push(sample.cpu.usagePercent);
}
});
await DeviceInfo.startMonitoring({
intervalMs: 1000,
emitImmediately: true,
});
// Later:
await DeviceInfo.stopMonitoring();
await handle.remove();
Stream metrics into a chart emitImmediately: falseMonitoring defaults to a 1000 ms interval, clamps intervals below 250 ms, and emits an immediate sample unless you set startMonitoring() . Calling sequence, startedAtagain restarts the active session with the new options. Each event includes its elapsedMs.
, and durationMs Use sampleCount or await DeviceInfo.removeAllListeners().
Capacitor live-update alternatives comparison page
Appflow comparison / migration marketing copy. Role: Short UI label or navigation item. Seen in: page ionic-appflow.astro, page ionic-enterprise-plugins.astro, page solutions/ionic-enterprise-plugins.astro. Message key `appflow_plugins_or` (Appflow Plugins Or).
このプラグインは気象データを取得しません。外気温と湿度は別の場所と気象API統合が必要です。
フルリファレンス
続けてください
あなたが使用している @capgo/capacitor-device-info 診断または監視画面を作成するには、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-device-info @capgo/capacitor-device-info 概要の場合、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-device-info と接続してください。 インストールとAPIの例用 Using @capgo/capacitor-barometer 専用圧力ストリーミング用 Using @capgo/capacitor-light-sensor 専用光度読み取り用