はじめに
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップの質問をコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-barometer`
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/barometer/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-barometer` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-barometerbunx cap syncインポート
「インポート」import { CapacitorBarometer } from '@capgo/capacitor-barometer';APIの概要
APIの概要getMeasurement
getMeasurement最新のバロメーター値を取得します。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.getMeasurement();isAvailable
__CAPGO_KEEP_0__の概要現在のデバイスがバロメーター センサーを備えているかどうかを確認します。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.isAvailable();startMeasurementUpdates
__CAPGO_KEEP_0__の概要バロメーター値のストリーミングをJavaScript層に開始します。
startMeasurementUpdates()関数に measurement 更新を受け取るイベント。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.startMeasurementUpdates();stopMeasurementUpdates
「測定更新を停止する」セクションCloudflare による . により開始された連続的な更新を停止します。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.stopMeasurementUpdates();checkPermissions
「パーミッションを確認する」セクションバロメーターデータへのアクセス権の現在の状態を返します。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.checkPermissions();requestPermissions
「パーミッションを要求する」セクションバロメーターデータへのアクセス権を要求します。プラットフォームが必要とするとします。
import { CapacitorBarometer } from '@capgo/capacitor-barometer';
await CapacitorBarometer.requestPermissions();GetMeasurementResult
「GetMeasurementResult」セクション最新の圧力サンプルのエイリアスです。
export type GetMeasurementResult = Measurement;IsAvailableResult
「IsAvailableResult」セクションクラスによって返される結果です。
export interface IsAvailableResult { /** * Indicates whether the device exposes a barometer sensor. * * @since 1.0.0 */ isAvailable: boolean;}PermissionStatus
「PermissionStatus」セクションクラスとクラスによって返される許可情報です。
export interface PermissionStatus { /** * The permission state for accessing barometer measurements on the current platform. * * @since 1.0.0 */ barometer: BarometerPermissionState;}MeasurementEvent
「MeasurementEvent」セクションクラスが有効のときに発行されるイベントペイロードです。
export type MeasurementEvent = Measurement;Measurement
「測定」のセクションデバイスの気圧計から取得した気圧と相対高さの値。
export interface Measurement { /** * The static air pressure in hectopascals (hPa). * * @since 1.0.0 */ pressure: number;
/** * The change in altitude relative to the time updates started. * Only available on iOS; Android will always return `0`. * * @since 1.0.0 */ relativeAltitude: number;
/** * The timestamp of the measurement in milliseconds since the Unix epoch. * * @since 1.0.0 */ timestamp: number;}BarometerPermissionState
「気圧計許可状態」のセクション許可状態のunion、 limited センサーへのアクセスを制限できるプラットフォーム向け
export type BarometerPermissionState = PermissionState | 'limited';PermissionState
「許可状態」のセクションPlatform permission states supported by Capacitor.
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';真実の源
「ソース・オブ・トゥルース」このページはプラグインから生成されています。 src/definitions.ts.再度、パブリックAPIがアップストリームで変更されたときに、syncを実行してください。
「Getting Started」から続けてください。
「Getting Started」から続けてください。あなたが「Getting Started」を使用してダッシュボードと__CAPGO_KEEP_0__のオペレーションを計画している場合、__CAPGO_KEEP_0__を__CAPGO_KEEP_1__-barometerと接続してください。 「@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-barometer」を使用して、__CAPGO_KEEP_0__のネイティブ機能を使用してください。 「@API/__CAPGO_KEEP_1__-barometer」を使用して、APIのネイティブ機能を使用してください。 Using @capgo/capacitor-barometer for the native capability in Using @capgo/capacitor-barometer, APIの概要 APIの実装詳細 導入 導入の実装詳細について API キー API キーの実装詳細について デバイス デバイスの実装詳細について