Skip to content

ESNetworkModule

getActiveNetworkInfo()

功能描述

获取网络状态。

参数

返回值

Object networkInfo

属性类型默认值说明
typeNumber``networkInfo.getType()
typeNameString``networkInfo.getTypeName()
subtypeNumber``networkInfo.getSubtype()
stateNumber``networkInfo.getState().ordinal()
extraInfoString``networkInfo.getExtraInfo()
isAvailableBoolean``networkInfo.isAvailable()
isConnectedBoolean``nnetworkInfo.isConnected()
isConnectedOrConnectingBoolean``networkInfo.isConnectedOrConnecting()
isFailoverBoolean``networkInfo.isFailover()
isRoamingBoolean``networkInfo.isRoaming()
detailedStateNumber``networkInfo.getDetailedState()
describeContentsNumber``networkInfo.describeContents()

示例代码

点击查看源码
js
ESNetworkModule.getActiveNetworkInfo().then(
    (networkInfo) => {
    },
    error => {
    }
);

注意