
public static boolean checkNetworkConnection(Context context) {
ConnectivityManager cManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cManager.getActiveNetworkInfo();
if( info != null && info.isAvailable()) {
return true;
}
else
return false;
}



中级程序员
by: 竹菜板 发表于:2014-07-30 20:35:23 顶(0) | 踩(0) 回复
这个只能判断网络是否连接,不能判断网络是否正常/通畅。
回复评论