自:人在码途::http://blog.csdn.net/ljsbuct/article/details/8692203
2.类结构分析
常量定义
静态工具方法
public static String getNetworkTypeName(int type) #根据type返回名称
public static boolean isNetworkTypeMobile(int networkType) #判断是否是mobile type
public static boolean isNetworkTypeValid(int networkType)
Network状态获取接口
public void setNetworkPreference(int preference) # 设置network连接优先级,preference为network type常量
public int getNetworkPreference()
public NetworkInfo getActiveNetworkInfo() #获取当前激活状态的NetworkInfo
public NetworkInfo getActiveNetworkInfoForUid(int uid) #根据uid获取
public NetworkInfo getNetworkInfo(int networkType) #根据network type
NetworkInfo[] getAllNetworkInfo() #获取所有的
public LinkProperties getActiveLinkProperties() #获取当前激活状态的LinkProperties
public LinkProperties getLinkProperties(int networkType) #根据network type 获取
public NetworkQuotaInfo getActiveNetworkQuotaInfo()#获取NetworkQuotaInfo信息
public boolean getMobileDataEnabled() #获取mobile的data连接状况
public String[] getTetherableIfaces() #获取可共享iface列表
public String[] getTetheredIfaces() #获取共享的iface列表
public String[] getTetheringErroredIfaces() #获取共享error的列表
public boolean isTetheringSupported() #检测是否支持共享
public int getLastTetherError(String iface) #获取共享error
public String[] getTetherableUsbRegexs() #获取usb共享规则???(未知)
public String[] getTetherableWifiRegexs()
public String[] getTetherableBluetoothRegexs()
public boolean isNetworkSupported(int networkType) #判断硬件是否支持这类network
public boolean isActiveNetworkMetered()
功能控制接口
public boolean setRadios(boolean turnOn) #设置所有radio的开关
public boolean setRadio(int networkType, boolean turnOn) #设置某个network type的radio开关
public int startUsingNetworkFeature(int networkType, String feature) #请求某个feature???(未知)
public int stopUsingNetworkFeature(int networkType, String feature)#
public boolean requestRouteToHost(int networkType, int hostAddress)#测试network type到某个address的路由是否是通路
public void setMobileDataEnabled(boolean enabled) #设置mobile的data连接开关
public int tether(String iface) #连接iface共享
public int untether(String iface) #解除共享iface
public int setUsbTethering(boolean enable) #控制usb共享