网络模块

API

DataStructure

ESNetworkInfo

网络信息

NameDescriptionTypeDefault
type网络类型ESNetworkInfoType-
typeName网络名称string-
state网络状态ESNetworkInfoState-
extraInfo额外信息string-
isAvailable网络是否可用boolean-
isConnected网络是否链接boolean-
isConnectedOrConnecting是否正在连接或者已经连接boolean-
isFailoverisFailoverboolean-
isRoamingisRoamingboolean-
detailedStatedetailedStateboolean-
describeContentsdescribeContentsboolean-

ESNetworkInfoType

网络类型信息

NameDescriptionTypeDefault
ES_NETWORK_INFO_TYPE_NONE无网络number-1
ES_NETWORK_INFO_TYPE_MOBILE移动网络number0
ES_NETWORK_INFO_TYPE_WIFIWIFI网络number1
ES_NETWORK_INFO_TYPE_ETHERNET有线网络number9

ESNetworkInfoState

网络状态信息

NameDescriptionTypeDefault
ES_NETWORK_INFO_STATE_CONNECTING正在连接number0
ES_NETWORK_INFO_STATE_CONNECTED已连接number1
ES_NETWORK_INFO_STATE_SUSPENDED挂起number2
ES_NETWORK_INFO_STATE_DISCONNECTING正在断开连接number3
ES_NETWORK_INFO_STATE_DISCONNECTED断开连接number4
ES_NETWORK_INFO_STATE_UNKNOWN未知number5

Exposes

NameDescriptionType
getActiveNetworkInfo该方法获取可用网络信息Function
isNetworkConnected该方法判断网络是否连接Function
getWifiInfo该方法获取WIFI信息Function
addListener该方法添加网络监听Function
removeListener该方法删除网络监听Function