Android Network State Check IsInternetReachable()

Here you can find the source of IsInternetReachable()

Description

Is Internet Reachable

Declaration

public static boolean IsInternetReachable() 

Method Source Code

//package com.java2s;
import java.io.IOException;
import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {
    public static boolean IsInternetReachable() {
        try {/*w ww.  j  a va  2  s.c o  m*/
            InetAddress.getByName("www.google.com").isReachable(3);
            return true;
        } catch (UnknownHostException e) {
            return false;
        } catch (IOException e) {
            return false;
        }
    }
}

Related

  1. isNetworkAvailable(Context context)
  2. getNetworkState(Context context)
  3. isLocationEnabledNetwork(Context c)
  4. isOpenNetwork(Context context)
  5. loadImageFromNetwork(String photoUrl)
  6. setMobileDataEnabled(Activity a, Context context, boolean enabled)
  7. isNetworkAvailable(Activity mainActivity)
  8. isDeviceOnline(Activity activity)
  9. isConnected(final Activity act)