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

## validDeviceOnlineType

> [VERSION] DeviceKit >= 1.2.6

> [PLATFORM] iOS, Android

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

### Description

Determine whether the specified online type (onlineType) matches the connectivity method defined by the device thing model

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `1.2.6` | Device ID |
| `onlineType` | `number` | Yes | - | `1.2.6` | Device network online types, represented with bitwise flags; multiple online states can be combined. 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) |
| `complete` | `() => void` | No | - | - | Callback invoked when the API call completes (runs on success or failure) |
| `success` | `(params: boolean) => void` | No | - | - | Callback for a successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on API call failure |

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