---
name: "getScreenBrightness"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.3.2" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getScreenBrightness

> [VERSION] BaseKit >= 2.3.2

> [PLATFORM] iOS, Android

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

### Description

Get screen brightness

### Parameters

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `complete` | `() => void` | No | - | Callback fired when the API call completes (runs on success or failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | Callback for a successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | Callback for a failed API call |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `value` | `number` | `3.2.6` | Screen brightness value, range 0–1. 0 is darkest, 1 is brightest |

#### 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` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

```tsx
ty.getScreenBrightness({
  success: data => {
    console.log(data.value);
  },
  fail: error => {
    console.error(error);
  },
});
```
