/** * Check if there is any connectivity to a mobile network * * @param context * @return */ public static boolean isConnectedMobile(Context context) { NetworkInfo info = Connectivity.getNetworkInfo(context); return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE); }
/** * Check if there is fast connectivity * * @param context * @return */ public static boolean isConnectedFast(Context context) { NetworkInfo info = Connectivity.getNetworkInfo(context); return (info != null && info.isConnected() && Connectivity.isConnectionFast(info.getType(), info.getSubtype())); }
/** * Check if there is any connectivity * * @param context * @return true or false */ public static boolean isConnected(Context context) { NetworkInfo info = Connectivity.getNetworkInfo(context); return (info != null && info.isConnected()); }