ボリュームボタン__CAPGO_KEEP_0__リポジトリ
インストール手順とこのプラグインの完全なマークダウンガイドまでのセットアッププロンプトをコピーしてください。
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-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-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」のセクションネイティブのCapacitor プラグインのバージョンを取得します。
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」から」のセクションあなたが使用している場合 「Getting Started」 ダッシュボードとAPIの計画と運用のために、接続する Using @capgo/capacitor-ボリュームボタン Using @capgo/capacitor-ボリュームボタン APIの概要 APIの概要 導入 導入 APIのキー APIのキー デバイス デバイス