什么是可能的参数可以传递给getNetworkInfo()

时间:2014-11-06 17:20:24

标签: android network-programming android-wifi

我已经检查了建议的问题here,但是当我检查了有关方法getNetworkInfo() here的文档时,没有关于此方法可以处理的可能整数值的文档。例如,如果我将0传递给getNetworkInfo(),这意味着我正在检查移动网络,如果是1,我正在检查WiFi的状态。

还有其他可能的值吗?为什么他们不在文档中?

1 个答案:

答案 0 :(得分:2)

来自文档:http://developer.android.com/reference/android/net/ConnectivityManager.html

public static final int TYPE_NONE        = -1;

public static final int TYPE_MOBILE      = 0;

public static final int TYPE_WIFI        = 1;

public static final int TYPE_MOBILE_MMS  = 2;

public static final int TYPE_MOBILE_SUPL = 3;

public static final int TYPE_MOBILE_DUN  = 4;

public static final int TYPE_MOBILE_HIPRI = 5;

public static final int TYPE_WIMAX       = 6;

public static final int TYPE_BLUETOOTH   = 7;

public static final int TYPE_DUMMY       = 8;

public static final int TYPE_ETHERNET    = 9;

public static final int TYPE_MOBILE_FOTA = 10;

public static final int TYPE_MOBILE_IMS  = 11;

public static final int TYPE_MOBILE_CBS  = 12;

public static final int TYPE_WIFI_P2P    = 13;

public static final int TYPE_MOBILE_IA = 14;