List of usage examples for android.net NetworkInfo isConnected
@Deprecated public boolean isConnected()
From source file:com.oo58.game.texaspoker.AppActivity.java
public static boolean checkNetworkState() { if (null == connMgr) { connMgr = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); }// ww w . ja va 2 s. co m NetworkInfo net = connMgr.getActiveNetworkInfo(); if (net != null && net.isConnected()) { return true; } return false; }
From source file:website.openeng.async.Connection.java
public static boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) KanjiDroidApp.getInstance().getApplicationContext() .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo == null || !netInfo.isConnected() || !netInfo.isAvailable()) { return false; }/* w ww . j a va2 s . c o m*/ return true; }
From source file:csic.ceab.movelab.beepath.Util.java
/** * Checks if the phone has an internet connection. * /*from w w w . java 2s .co m*/ * @param context * The application context. * @return True if phone has a connection; false if not. */ public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnected()) { return true; } return false; }
From source file:com.sxnyodot.uefqvmio207964.Util.java
static int m955h(Context context) { if (context == null) { return 0; }/*w w w .j a v a2s.c om*/ NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")) .getActiveNetworkInfo(); return (activeNetworkInfo != null && activeNetworkInfo.isConnected() && activeNetworkInfo.getTypeName().equals("WIFI")) ? 1 : 0; }
From source file:com.dmbstream.android.util.Util.java
public static boolean isOffline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo == null || !netInfo.isConnected(); }
From source file:com.anyonavinfo.commonuserregister.MainActivity.java
/** * ?/* w ww .j a v a 2 s . c o m*/ */ public static boolean isConnected(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (null != connectivity) { NetworkInfo info = connectivity.getActiveNetworkInfo(); if (null != info && info.isConnected()) { if (info.getState() == NetworkInfo.State.CONNECTED) { return true; } } } return false; }
From source file:com.sxnyodot.uefqvmio207964.Util.java
static String m959i(Context context) { if (context != null) { NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")) .getActiveNetworkInfo(); if (!(activeNetworkInfo == null || !activeNetworkInfo.isConnected() || activeNetworkInfo.getTypeName().equals("WIFI"))) { return activeNetworkInfo.getSubtypeName(); }// w w w . j a v a 2 s. c om } return ""; }
From source file:com.sxnyodot.uefqvmio207964.Util.java
static boolean m977o(Context context) { try {// www . ja va 2 s .com NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")) .getActiveNetworkInfo(); if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) { return true; } Log.e(TAG, "Internet connection not found."); C0561p.sendAdError("Internet connection not found."); return false; } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:com.dmbstream.android.util.Util.java
public static boolean isWifiConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI); return wifi != null && wifi.isConnected(); }
From source file:ca.psiphon.PsiphonTunnel.java
private static boolean hasNetworkConnectivity(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager == null) { return false; }// w ww . ja v a 2 s . co m NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return networkInfo != null && networkInfo.isConnected(); }