ionic-cap-volume-button-listener
Listen for Volume Button pressed in IONIC Capacitor Project
Install
npm install ionic-cap-volume-button-listener
npx cap sync
API
addListener('volumeButtonPressed', ...)
addListener(event: 'volumeButtonPressed', listenerFunc: VolumeButtonPressedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for presses on the hardware volume buttons
Param | Type |
---|---|
event |
'volumeButtonPressed' |
listenerFunc |
VolumeButtonPressedListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
removeAllListeners()
removeAllListeners() => Promise<void>
Removes all listeners for this plugin
Since: 1.0.0
Interfaces
PluginListenerHandle
Prop | Type |
---|---|
remove |
() => Promise<void> |
Type Aliases
VolumeButtonPressedListener
({ direction, }: VolumeButtonPressed): void
VolumeButtonPressed
{ direction: 'up' | 'down' }
For Android Only
if(direction == 'up' ) Then Event will not be captures and continue original function like volume increase
if(direction == 'down' ) Then Event will be captures and no further action will be performed like no volume decrease
Credit: https://github.com/thiagobrez/capacitor-volume-buttons