wx.getNetworkType(Object object)
Gets the network type.
Parameters
Object object
| Attribute | Type | Default | Required | Description |
| success | function | | No | The callback function for a successful API call |
| fail | function | | No | Callback function for failed API call |
| complete | function | | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
object.success callback function
Parameters
Object res
| Property | Type | Description |
| networkType | string | Network type |
Valid values of res.networkType
| Value | Description | Minimum Version |
| wifi | Wi-Fi network | |
| 2g | 2G network | |
| 3g | 3G network | |
| 4g | 4G network | |
| unknown | Uncommon network types for Android | |
| none | No network | |
Sample Code