Retrieves the current network type of the device. Use this API when developing H5 applications or mini programs with WindVane.
WVNetwork.getNetworkType
Retrieves the current network type. The result is always returned through the success callback.
window.WindVane.call('WVNetwork', 'getNetworkType', {}, function(e) {
alert(JSON.stringify(e));
});
Input parameters
[
boolean] wifiStatus: Specifies whether to retrieve details of the connected Wi-Fi network. Set totrueto includessidandbssidin the callback result. Applies only to active Wi-Fi connections. RequiresWindVane 8.2.0 or later.[
boolean] wifiList: Specifies whether to retrieve a list of nearby Wi-Fi networks. Set totrueto includewifiListin the callback result. RequiresWindVane Android 8.2.0 or later. Not supported on iOS.
Callback parameters
These parameters are returned in the success callback.
-
[
string] type: The current network type. Valid values:'WIFI': Connected to Wi-Fi.'2G': Connected to a 2G network.'3G': Connected to a 3G network.'4G': Connected to a 4G network.'CELL': Connected to a cellular network. The network generation (2G/3G/4G) cannot be determined.'NONE': No network connection.'UNKNOWN': The network type cannot be determined.
[
string] message: The name of the network system. Omitted when the network system is unknown.[
string] ssid: The SSID of the connected Wi-Fi network. Returned only whenwifiStatusistrue. RequiresWindVane 8.2.0 or later.[
string] bssid: The BSSID of the connected Wi-Fi network. Returned only whenwifiStatusistrue. RequiresWindVane 8.2.0 or later.[
Array] wifiList: A list of nearby Wi-Fi networks. RequiresWindVane Android 8.2.0 or later. Not supported on iOS. Each item in the array is an object with the following properties:[
string] ssid: The SSID of the Wi-Fi network.[
string] bssid: The BSSID of the Wi-Fi network.