NetworkInfo.State : NetworkInfo « Network « Android






NetworkInfo.State

  
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

class Main {

  public static boolean checkInternet(Object systemService) {

    ConnectivityManager connect = (ConnectivityManager) systemService;
    if (connect.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED
        || connect.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED) {
      return true;
    }
    return false;
  }
}

   
    
  








Related examples in the same category

1.Network Information