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.
インストール
「インストール」のセクションAI-Assisted セットアップを使用してプラグインをインストールできます。次のコマンドを使用して、Capgo スキルをAIツールに追加します。
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
リスナーを追加ハードウェアのボリュームボタンの押下を検知する
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
リスナーをすべて削除リスナーをすべて削除
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
__CAPGO_KEEP_0__のネイティブプラグインバージョンを取得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
VolumeButtonPressedボリュームボタン押下のイベントデータ
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
VolumeButtonDirectionボリュームボタンの押下方向
export type VolumeButtonDirection = 'up' | 'down';ソース・オブ・トラース
ソース・オブ・トラースこのページはプラグインのソースコードから自動生成されています src/definitions.ts. API を再度同期するには、上流で API が変更されたときに再度同期してください。
続けて "Getting Started" から進みます。
「続けて "Getting Started" から進みます。」あなたが使用している場合 「Getting Started」 ダッシュボードと API の作業を計画するために使用している場合、API を接続してください。 「@capgo/capacitor-volume-buttons」を使用 「@capgo/capacitor-volume-buttons」を使用して、@capgo/capacitor-volume-buttons のネイティブ機能を使用 API の概要 API の概要を使用して、@API/__CAPGO_KEEP_1__-volume-buttons の実装詳細を使用 導入 導入を使用して、導入の実装詳細を使用 API キー API キーの実装詳細について デバイス デバイスの実装詳細について