package org.qinshuihepan.bbs.util.update; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created by hp on 14-9-18. */ public class NetChecker { public static boolean checkNetworkConnection(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeInfo = connMgr.getActiveNetworkInfo(); if (activeInfo != null && activeInfo.isConnected()) { return true; } else { return false; } } }