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-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 セットアップを使用してプラグインをインストールできます。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 セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
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
「VolumeButtonPressed」セクションボリュームボタン押下イベントデータ
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
VolumeButtonDirectionのセクションボリュームボタンの押し方
export type VolumeButtonDirection = 'up' | 'down';真実の源
真実の源のセクションこのページはプラグインから生成されています。 src/definitions.tsパブリックAPIがアップストリームで変更された場合に再度Syncを実行してください。
Getting Startedから続けてください
Getting Startedのセクションあなたが Getting Started ダッシュボードとAPIの作業を計画する場合に使用している場合に接続してください Using @capgo/capacitor-ボリュームボタン for the native capability in Using @capgo/capacitor-ボリュームボタン, API の概要 for the implementation detail in API の概要, 導入 for the implementation detail in導入, API のキー for the implementation detail in API のキー, と デバイス for the implementation detail in デバイス。