my.getNetworkType retrieves the current network type of the device, such as WiFi, 2G, 3G, 4G, or offline status.
my.getNetworkType({
success: (res) => {
console.log(res.networkAvailable);
console.log(res.networkType);
},
});
| Property | Type | Required | Description |
|---|---|---|---|
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Description |
|---|---|---|
networkAvailable | Boolean | Whether the network is available. |
networkType | String | Network type values: • WIFI: WiFi network• 2G: 2G network• 3G: 3G network• 4G: 4G network• UNKNOWN: Unknown network• NOTREACHABLE: No network• NONE: None |