首页 > 代码库 > 网络相关

网络相关

    /**     * 判断有没有网络     *      * @return     */    public boolean isNetworkConnected() {        // 判断网络是否连接        ConnectivityManager mConnectivityManager = (ConnectivityManager) this                .getSystemService(Context.CONNECTIVITY_SERVICE);        NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();        if (mNetworkInfo != null) {            return mNetworkInfo.isAvailable();        }        return false;    }

 

网络相关