# ionic-cap-volume-button-listener

> Listen for Volume Button pressed in IONIC Capacitor Project

Latest version **3.0.0** (published 2023-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ionic-cap-volume-button-listener
pnpm add ionic-cap-volume-button-listener
yarn add ionic-cap-volume-button-listener
bun add ionic-cap-volume-button-listener
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2023-01-18 |
| First published | 2022-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zia Ur Rehman |
| Maintainers | ziaa520 |
| Keywords | capacitor, plugin, native, volumeButton, hardwareButton, volume, ionic |

## Links

- npm: https://www.npmjs.com/package/ionic-cap-volume-button-listener
- Repository: https://github.com/ziaurrehmanjutt/ionic-android-volum-button-listner
- Homepage: https://github.com/ziaurrehmanjutt/ionic-android-volum-button-listner#readme
- Issues: https://github.com/ziaurrehmanjutt/ionic-android-volum-button-listner/issues
- npm.io page: https://npm.io/package/ionic-cap-volume-button-listener

## Recent versions

- 3.0.0 (latest) — 2023-01-18
- 2.0.1 — 2023-01-16
- 2.0.0 — 2023-01-16
- 1.0.0 — 2022-12-13
- 0.0.4 — 2022-12-12
- 0.0.3 — 2022-12-12

## README

# ionic-cap-volume-button-listener

Listen for Volume Button pressed in IONIC Capacitor Project

## Install

```bash
npm install ionic-cap-volume-button-listener
npx cap sync
```

## API

<docgen-index>

* [`addListener('volumeButtonPressed', ...)`](#addlistenervolumebuttonpressed)
* [`removeAllListeners()`](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### addListener('volumeButtonPressed', ...)

```typescript
addListener(event: 'volumeButtonPressed', listenerFunc: VolumeButtonPressedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
```

Listen for presses on the hardware volume buttons

| Param              | Type                                                                                |
| ------------------ | ----------------------------------------------------------------------------------- |
| **`event`**        | <code>'volumeButtonPressed'</code>                                                  |
| **`listenerFunc`** | <code><a href="#volumebuttonpressedlistener">VolumeButtonPressedListener</a></code> |

**Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>

**Since:** 1.0.0

--------------------


### removeAllListeners()

```typescript
removeAllListeners() => Promise<void>
```

Removes all listeners for this plugin

**Since:** 1.0.0

--------------------


### Interfaces


#### PluginListenerHandle

| Prop         | Type                                      |
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |


### Type Aliases


#### VolumeButtonPressedListener

<code>({ direction, }: <a href="#volumebuttonpressed">VolumeButtonPressed</a>): void</code>


#### VolumeButtonPressed

<code>{ direction: 'up' | 'down' }</code>

</docgen-api>

For Android Only
<code>if(direction == 'up' ) Then Event will not be captures and continue original function like volume increase</code>

<code>if(direction == 'down' ) Then Event will be captures and no further action will be performed like no volume decrease</code>


Credit: https://github.com/thiagobrez/capacitor-volume-buttons

---
_Source: https://npm.io/package/ionic-cap-volume-button-listener · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
