Android Context Check isOnline(Context context)

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

Description

is Online

Declaration

public static boolean isOnline(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 isOnline(Context context) {
        ConnectivityManager cm = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netInfo = cm.getActiveNetworkInfo();
        if (netInfo != null && netInfo.isConnectedOrConnecting()) {
            return true;
        }//  w ww .  ja v  a  2  s .  c o m
        return false;
    }
}

Related

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