List of usage examples for android.net NetworkInfo isConnected
@Deprecated public boolean isConnected()
From source file:com.ryan.ryanreader.common.General.java
/** * /*from w w w . ja v a 2 s . c o m*/ * ?WIFI * * @param context * @return */ public static boolean isConnectionWifi(final Context context) { final ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI); return info != null && info.isConnected(); }
From source file:com.amazonaws.utilities.Util.java
public static boolean isOnline(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivity.getActiveNetworkInfo(); if (activeNetworkInfo != null) { boolean networkAvailable = activeNetworkInfo.isAvailable(); boolean networkConnected = activeNetworkInfo.isConnected(); if (networkAvailable && networkConnected) { return true; } else {//w w w . j av a 2 s .co m return false; } } else { return false; } }
From source file:com.nloko.android.Utils.java
public static boolean hasInternetConnection(Context context) { if (context == null) { throw new IllegalArgumentException("context"); }//from ww w .ja v a 2 s . com ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return (info != null && info.isConnected()); }
From source file:com.ntsync.android.sync.shared.SyncUtils.java
/** * Check if a network is active and connected. * //from w w w . ja v a2 s .com * @param context * @return true if an active network is available. */ public static boolean isNetworkConnected(Context context) { ConnectivityManager cMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cMgr.getActiveNetworkInfo(); return activeNetwork != null && activeNetwork.isConnected(); }
From source file:org.basdroid.common.NetworkUtils.java
/** * Check if there is any connectivity// www.j ava 2 s .c om * @param context * @return */ public static boolean isConnected(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected()); }
From source file:org.basdroid.common.NetworkUtils.java
/** * Check if there is any connectivity to a Wifi network * @param context// www . j a va2s .c o m * @return */ public static boolean isConnectedWifi(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_WIFI); }
From source file:org.basdroid.common.NetworkUtils.java
/** * Check if there is any connectivity to a mobile network * @param context// w w w. j a va 2 s . c o m * @return */ public static boolean isConnectedMobile(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE); }
From source file:org.basdroid.common.NetworkUtils.java
/** * Check if there is fast connectivity/*from www .j av a 2 s .c o m*/ * @param context * @return */ public static boolean isConnectedFast(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected() && isConnectionFast(info.getType(), info.getSubtype())); }
From source file:com.otaupdater.utils.Utils.java
public static boolean dataAvailable(Context ctx) { ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); return ni != null && ni.isConnected(); }
From source file:com.otaupdater.utils.Utils.java
public static boolean wifiConnected(Context ctx) { ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); return ni != null && ni.isConnected() && ni.getType() == ConnectivityManager.TYPE_WIFI; }