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

## getNetworkType

> [VERSION] BaseKit >= 2.0.1

> [PLATFORM] iOS, Android

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

### Description

Get network type

### 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 |
| --- | --- | --- | --- |
| `networkType` | `string` | `3.2.6` | Network type |
| `signalStrength` | `number` | `3.2.6` | Signal strength, unit: dBm Note: Not supported on iOS |

#### 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
// Get current network type and signal strength (signalStrength supported on Android only)
ty.getNetworkType({
  success: data => console.log("Network type:", data.networkType, "Signal:", data.signalStrength),
  fail: error => console.error(error),
});
```
