Android Network State Check isMobileOnline(Context context)

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

Description

is Mobile Online

Declaration

public static boolean isMobileOnline(Context context) 

Method Source Code

//package com.java2s;

import android.content.Context;

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

public class Main {
    public static boolean isMobileOnline(Context context) {
        ConnectivityManager conMan = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);

        State mobile = conMan.getNetworkInfo(
                ConnectivityManager.TYPE_MOBILE).getState();

        if (mobile == NetworkInfo.State.CONNECTED)
            return true;
        else/*  w  w w.j  a  v a2s.  co  m*/
            return false;
    }
}

Related

  1. isConMeNetwork(String ssid)
  2. isConnectNetWork(final Context context)
  3. isOnline(Context context)
  4. isNetworkAvailable(Context context)
  5. isNetworkAvailable(Context context)
  6. isInternetReachable(Context context)
  7. isHightBandwidthConnection(Context context)
  8. isConnectionFast(int type, int subType)
  9. isNetAvailable(Context context)