Android Network State Check isNetworkAvailable(Context context)

Here you can find the source of isNetworkAvailable(Context context)

Description

is Network Available

Declaration

public static boolean isNetworkAvailable(Context context) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.net.ConnectivityManager;

public class Main {

    public static boolean isNetworkAvailable(Context context) {
        boolean netWorkStatus = false;
        if (null != context) {
            ConnectivityManager connManager = (ConnectivityManager) context
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            if (connManager.getActiveNetworkInfo() != null) {
                netWorkStatus = connManager.getActiveNetworkInfo()
                        .isAvailable();/*from  ww w  . j a v  a 2s  .  c o  m*/
            }
        }
        return netWorkStatus;
    }
}

Related

  1. isInternetReachable(Context context)
  2. isHightBandwidthConnection(Context context)
  3. isConnectionFast(int type, int subType)
  4. isNetAvailable(Context context)
  5. isNetworkAvailable(Context context)
  6. isNetworkAvailable(Context context)
  7. isNetworkAvailable(Context paramContext)
  8. isNetworkAvailable(Context context)
  9. isNetworkRoaming(Context context)