Getting Started
このプラグインのインストール手順と完全なマークダウンガイドを含むセットアップの質問をコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-accelerometer`
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/accelerometer/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”You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-accelerometer` plugin in my project.If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
bun add @capgo/capacitor-accelerometerbunx cap syncImport
Section titled “Import”import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';API の概要
API のタイトル “API の概要”getMeasurement
__CAPGO_KEEP_0__ のタイトル “getMeasurement”加速度計の最新のサンプルを取得します。
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.getMeasurement();isAvailable
加速度計センサが搭載されているデバイスを確認します。__CAPGO_KEEP_0__ のタイトル “startMeasurementUpdates”
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.isAvailable();startMeasurementUpdates
__CAPGO_KEEP_0__ には、デバイスの加速度計センサが利用可能かどうかを確認するためのメソッドが含まれます。__CAPGO_KEEP_0__ には、加速度計のサンプルを取得するためのメソッドが含まれます。
__CAPGO_KEEP_0__ には、加速度計の更新をストリーミングするためのメソッドが含まれます。 measurement イベントを受信して更新を取得します。
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.startMeasurementUpdates();stopMeasurementUpdates
「ストップ測定更新」を含むセクションストリーミング加速度メーター更新を開始したものを停止します。
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.stopMeasurementUpdates();checkPermissions
「チェックパーミッション」を含むセクションモーションデータへのアクセス権の現在の状態を返します。
パーミッションが明示的に指定されていないプラットフォームでは granted.
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.checkPermissions();requestPermissions
「パーミッションを要求」を含むセクションモーションデータへのアクセス権を要求します。プラットフォームがパーミッションをサポートしている場合。
import { CapacitorAccelerometer } from '@capgo/capacitor-accelerometer';
await CapacitorAccelerometer.requestPermissions();種類リファレンス
種類リファレンスGetMeasurementResult
測定結果取得最新の測定値
export type GetMeasurementResult = Measurement;IsAvailableResult
利用可能性結果結果
export interface IsAvailableResult { /** * Whether an accelerometer sensor is available on the device. * * @since 1.0.0 */ isAvailable: boolean;}PermissionStatus
許可情報クリップボードにコピー
export interface PermissionStatus { /** * The permission state for accessing motion data on the current platform. * * @since 1.0.0 */ accelerometer: AccelerometerPermissionState;}MeasurementEvent
許可状況アクティブ状態のときに発行されるイベントペイロード。
export type MeasurementEvent = Measurement;Measurement
「測定」セクションのタイトルデバイスモーションセンサによって報告されるx、y、z軸の加速度値。
export interface Measurement { /** * The acceleration on the x-axis in G's. * * @since 1.0.0 */ x: number;
/** * The acceleration on the y-axis in G's. * * @since 1.0.0 */ y: number;
/** * The acceleration on the z-axis in G's. * * @since 1.0.0 */ z: number;}AccelerometerPermissionState
「加速度計許可状態」セクションのタイトル加速度計許可状態のユニオン、 limited モーションアクセスのサブスクリプションをサポートするプラットフォーム
export type AccelerometerPermissionState = PermissionState | 'limited';PermissionState
「許可状態」セクションのタイトルPlatform permission states supported by Capacitor.
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';真実の源
「真実の源」タイトルこのページはプラグインの src/definitions.ts公開 API がアップストリームで変更された場合に再度同期を実行してください。
Getting Started から続けて
「Getting Started から続けて」タイトルCapacitor を使用している場合 Getting Started ダッシュボードと API の作業を計画する場合、Capacitor を接続してください。 Capacitor の @capgo/capacitor-accelerometer を使用 Capacitor の @capgo/capacitor-accelerometer の場合のネイティブ機能 Capacitor の API オーバービュー API の実装詳細について Introduction __CAPGO_KEEP_0__ のキー API の実装詳細について、キーや for the implementation detail in API Keys, and __CAPGO_KEEP_0__ を編集 前