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 connMgr = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
        return (networkInfo != null && networkInfo.isConnected());
    }/*  w w w  .ja  va 2  s .co m*/
}

Related

  1. isNetAvailable(Context context)
  2. isOnline(Context c)
  3. isOnline(Context context)
  4. isOnline(Context context)
  5. isOnline(Context context)
  6. isPermissionGranted(Context ctx)
  7. isSensAppInstalled(Context context)
  8. isServiceRunning(Context ctx, String className)
  9. isServiceRunning(Context ctx, String className)