# wx.getNetworkType(Object object)
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Get network type
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# object.success callback
# parameter
# Object object
attribute | type | Introductions |
---|---|---|
networkType | string | Network type |
signalStrength | Number | Signal strength, unit dbm |
res.networkType Legal value
value | Introductions | Minimum version |
---|---|---|
wifi | wifi network | |
2g | 2g network | |
3g | 3g network | |
4g | 4g network | |
5g | 5g network | |
unknown | Android Less common network types under | |
none | No network |
# sample code
wx.getNetworkType({
success (res) {
const networkType = res.networkType
}
})