Getting Started
__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セットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
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-volume-buttons` 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-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';真実の源
このページはプラグインの__CAPGO_KEEP_0__がアップストリームで変更された場合に再度同期してください。 src/definitions.ts. Re-run the sync when the public API changes upstream.
あなたが Getting Started を計画ダッシュボードとAPI オペレーションに接続するには Using @capgo/capacitor-volume-buttons capgoのネイティブ機能のためにUsing @capgo/capacitor-volume-buttons API Overview APIの実装詳細のためにAPI Overview Introduction 実装詳細のためにIntroduction API Keys API Keysの実装詳細のために、 Devices __CAPGO_KEEP_0__の実装詳細についての情報は、デバイスのページにあります。