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;
import android.net.NetworkInfo;

public class Main {
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager
                .getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }/*w w  w . jav  a2  s  .  co  m*/
}

Related

  1. isNetworkReady(Context context)
  2. isConMeNetwork(String ssid)
  3. isConnectNetWork(final Context context)
  4. isOnline(Context context)
  5. isNetworkAvailable(Context context)
  6. isMobileOnline(Context context)
  7. isInternetReachable(Context context)
  8. isHightBandwidthConnection(Context context)
  9. isConnectionFast(int type, int subType)