---
name: "updateVolume"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.4.3" }
  - { name: "@ray-js/ray", version: "0.5.9" }
platform:
  - "iOS"
  - "Android"
async: true
---

## updateVolume

> [VERSION] BaseKit >= 2.4.3 | @ray-js/ray >= 0.5.9

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Set system volume

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `value` | `number` | Yes | - | `2.4.3` | Volume, range [0 - 1] |
| `volumeMode` | `number[]` | No | `[2]` | `3.3.3` | Volume type (Android only) 0: Voice call volume 1: System volume 2: Ringtone, notifications, system default sounds, etc. 3: Media volume 4: Alarm volume 5: Notification volume 6: Bluetooth volume |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Examples

#### Demo

```tsx
import { updateVolume } from '@ray-js/ray'

updateVolume({
  value: 0.5,
  volumeMode: [2],
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
