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

## onDeviceMotionChange

> [VERSION] BaseKit >= 2.3.2

> [PLATFORM] iOS, Android

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

### Description

Listen for device orientation change events (data provided by the system; precision may differ across platforms)

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `listener` | `(params: Object) => void` | Yes | - | Event listener callback function |

##### onDeviceMotionChange.listener(params) properties

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `alpha` | `number` | Yes | - | `2.3.2` | When the device X/Y axes align with the Earth's X/Y axes, the rotation angle about the Z axis is alpha, range [0, 2*PI). Counterclockwise is positive. |
| `beta` | `number` | Yes | - | `2.3.2` | When the device Y/Z axes align with the Earth's Y/Z axes, the rotation angle about the X axis is beta, range [-PI, PI). Tilting the top toward the Earth's surface is positive; on some platforms, tilting toward the user may be positive. |
| `gamma` | `number` | Yes | - | `2.3.2` | When the device X/Z axes align with the Earth's X/Z axes, the rotation angle about the Y axis is gamma, range [-PI/2, PI/2). Rotating the right side toward the Earth's surface is positive. |
| `isParamCorrection` | `boolean` | Yes | - | `3.36.0` | iOS only, whether to correct the alpha value |


### Examples

```tsx
// Device motion events require starting listening before callbacks; start first, then register.
ty.startDeviceMotionListening({ interval: "normal" });

ty.onDeviceMotionChange(e => {
  console.log(e);
});
```
