List of usage examples for android.net NetworkInfo isConnected
@Deprecated public boolean isConnected()
From source file:Main.java
public static boolean isNetWorkAvailable(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Activity.CONNECTIVITY_SERVICE); NetworkInfo info = manager.getActiveNetworkInfo(); return info != null && info.isConnected(); }
From source file:Main.java
public static boolean isNetworkConnected(Context context) { ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo net = conn.getActiveNetworkInfo(); if (net != null && net.isConnected()) { return true; } else {//from w ww . j a v a 2s . c o m return false; } }
From source file:Main.java
public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }
From source file:Main.java
static public boolean hasNetworkAccess(Context c) { ConnectivityManager network = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = network.getActiveNetworkInfo(); return info != null && info.isConnected(); }
From source file:Main.java
private static boolean isOnline(Context ctx) { final ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo info = cm.getActiveNetworkInfo(); return info != null && info.isConnected(); }
From source file:Main.java
public static boolean isNetworkAvailable(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni != null && ni.isConnected()) { return true; }/* w w w. j a v a2 s. c o m*/ return false; }
From source file:Main.java
public static boolean isOnline(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Activity.CONNECTIVITY_SERVICE); NetworkInfo info = manager.getActiveNetworkInfo(); return info != null && info.isConnected(); }
From source file:Main.java
public static boolean isNetConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { NetworkInfo[] infos = cm.getAllNetworkInfo(); if (infos != null) { for (NetworkInfo ni : infos) { if (ni.isConnected()) { return true; }//w ww . ja va 2 s . c o m } } } return false; }
From source file:Main.java
public static boolean isConnected(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = manager.getActiveNetworkInfo(); if (info != null && info.isConnected()) { return true; } else {//w w w . j a va2 s.co m return false; } }
From source file:Main.java
public static boolean isNetworkConnectionAvailable(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnected(); }