---
name: "getDeviceOnlineType"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "2.1.4" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getDeviceOnlineType

> [VERSION] DeviceKit >= 2.1.4

> [PLATFORM] iOS, Android

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

### Description

Check whether a specific channel of the device is online

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `4.11.0` | deviceId Device ID Supports cross-panel retrieval of other device information. The current panel can pass the current device ID to retrieve it. |
| `dps` | `Record<string, Record<string, any>>` | No | - | `4.11.0` | dps |
| `complete` | `() => void` | No | - | - | Callback executed when the API call completes (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback executed on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback executed on API call failure |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `onlineType` | `number` | `3.3.0` | Device network online types, represented as bit flags; use bitwise operations to check. Usage: (onlineType & (1 << bit)). For example: (onlineType & (1 << 0)) == true indicates Wi-Fi online; (onlineType & (1 << 2)) == true indicates Bluetooth online Defined as follows: bit 0 (1 << 0): Wi-Fi online (Cloud online \|\| Local online); if you only want to check cloud online, use bit 7 bit 1 (1 << 1): Local online bit 2 (1 << 2): BLE online bit 3 (1 << 3): BLEMesh online bit 4 (1 << 4): beacon online bit 5 (1 << 5): Dayu online bit 6 (1 << 6): System BT Online bit 7 (1 << 7): Cloud online bit 8 (1 << 8): Matter online (local) |

#### 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 |
