Android Context Check isOnline(Context c)

Here you can find the source of isOnline(Context c)

Description

is Online

Declaration

public static boolean isOnline(Context c) 

Method Source Code

//package com.java2s;

import android.content.Context;

import android.net.ConnectivityManager;

public class Main {
    public static boolean isOnline(Context c) {
        try {//from w ww  .j a v  a  2 s . c om
            ConnectivityManager cm = (ConnectivityManager) c
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            return cm.getActiveNetworkInfo().isConnectedOrConnecting();
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. isLandscape(final Context context)
  2. isLocationEnabledGPS(Context c)
  3. isMobile(Context context)
  4. isMobilityInstalled(Context context)
  5. isNetAvailable(Context context)
  6. isOnline(Context context)
  7. isOnline(Context context)
  8. isOnline(Context context)
  9. isOnline(Context context)