dlt.getNetworkType
Introduction
The dlt.getNetworkType function is used to get the current network environment.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for a successful API call. | |
| fail | function | No | Callback function for a failed API call. | |
| complete | function | No | Callback function that is called when the API call is complete (whether successful or not). |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| networkType | string | The current network environment. |
Possible Values for networkType
| Value | Description |
|---|---|
| wifi | Wi-Fi network |
| 2g | 2G network |
| 3g | 3G network |
| 4g | 4G network |
| 5g | 5G network |
| unknown | Uncommon network types on Android |
| none | No network |
Example Code
dlt.getNetworkType({
success(res) {
console.log(res.networkType);
},
});