Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
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.
Install
Section titled “Install”bun add @capgo/capacitor-volume-buttonsbunx cap syncImport
Section titled “Import”import { VolumeButtons } from '@capgo/capacitor-volume-buttons';API Overview
Section titled “API Overview”addListener
Section titled “addListener”Listen for presses on the hardware volume buttons.
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
Section titled “removeAllListeners”Removes all listeners for this plugin.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
Section titled “getPluginVersion”Get the native Capacitor plugin version.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();console.log('Plugin version:', version);Type Reference
Section titled “Type Reference”VolumeButtonListener
Section titled “VolumeButtonListener”Listener function for volume button events.
export type VolumeButtonListener = (event: VolumeButtonPressed) => void;VolumeButtonPressed
Section titled “VolumeButtonPressed”Event data for volume button press.
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
Section titled “VolumeButtonDirection”Direction of volume button press.
export type VolumeButtonDirection = 'up' | 'down';Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.