Skip to content

Cap-go/capacitor-volume-buttons

@capgo/capacitor-volume-buttons

Capgo - Instant updates for capacitor

Listen to volume button presses in Capacitor apps

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/volume-buttons/

Install

npm install @capgo/capacitor-volume-buttons
npx cap sync

API

Capacitor Volume Buttons Plugin for detecting hardware volume button presses.

addListener('volumeButtonPressed', ...)

addListener(eventName: 'volumeButtonPressed', listenerFunc: VolumeButtonListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for presses on the hardware volume buttons.

Param Type Description
eventName 'volumeButtonPressed' - The event name (must be 'volumeButtonPressed')
listenerFunc VolumeButtonListener - The function to call when a volume button is pressed

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 1.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners for this plugin.

Since: 1.0.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

VolumeButtonPressed

Event data for volume button press.

Prop Type Description
direction VolumeButtonDirection Direction of the button press

Type Aliases

VolumeButtonListener

Listener function for volume button events.

(event: VolumeButtonPressed): void

VolumeButtonDirection

Direction of volume button press.

'up' | 'down'

About

Capacitor plugin to listen to volume button presses

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •