はじめから始める
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-volume-buttons`
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/volume-buttons/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アシストセットアップを使用してプラグインをインストールできます。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-volume-buttons` plugin in my project.Manual Setup を使用する場合は、以下のコマンドを実行してプラットフォーム固有の指示に従ってください:
bun add @capgo/capacitor-volume-buttonsbunx cap syncインポート
「インポート」のセクションimport { VolumeButtons } from '@capgo/capacitor-volume-buttons';API の概要
「API の概要」のセクションaddListener
「addListener」のセクションハードウェアボリュームボタンの押下を検知する。
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const listener = await VolumeButtons.addListener( 'volumeButtonPressed', (event) => { console.log(`Volume ${event.direction} button pressed`); });
// Remove listener when doneawait listener.remove();removeAllListeners
「removeAllListeners」を含むセクションこのプラグインのすべてのリスナーを削除します。
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
「getPluginVersion」を含むセクションGet the native Capacitor plugin version.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();console.log('Plugin version:', version);型の参照
「型の参照」を含むセクションVolumeButtonListener
「VolumeButtonListener」を含むセクションボリュームボタンイベントのリスナー関数
export type VolumeButtonListener = (event: VolumeButtonPressed) => void;VolumeButtonPressed
「ボリュームボタンが押された」セクションボリュームボタン押下のイベントデータ
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
「ボリュームボタン方向」セクションボリュームボタン押下の方向
export type VolumeButtonDirection = 'up' | 'down';真実の源
「真実の源」セクションこのページはプラグインの設定から生成されています。 src/definitions.ts公開 API がアップストリームで変更された場合に再度同期を実行してください。
「はじめから始める」から続けてください
「Getting Started」から続けてあなたが「を使用している場合 Getting Started ダッシュボードとAPIの操作を計画するには、を接続してください native capabilityのために@capgo/capacitor-volume-buttonsを使用 Using @capgo/capacitor-volume-buttonsのnative capabilityの実装詳細 API Overview API Overviewの実装詳細 Introduction Introductionの実装詳細 API Keys API Keysの実装詳細 デバイス デバイスの実装詳細について