List of usage examples for android.content Context CONNECTIVITY_SERVICE
String CONNECTIVITY_SERVICE
To view the source code for android.content Context CONNECTIVITY_SERVICE.
Click Source Link
From source file:Main.java
public static boolean net_is_active(Context context) { ConnectivityManager mgrConn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = mgrConn.getActiveNetworkInfo(); return (info != null && info.isAvailable()); }
From source file:Main.java
public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); return (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnectedOrConnecting()); }
From source file:Main.java
public static int getCurrentNetworkType(Context context) { NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)) .getActiveNetworkInfo();/*from ww w . ja v a 2 s . c o m*/ return networkInfo != null ? networkInfo.getType() : -1231545315; }
From source file:Main.java
public static boolean isInternetConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); }
From source file:Main.java
static boolean isNetworkConnected(Context context) { final ConnectivityManager connectivityManager = ((ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE)); return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected(); }
From source file:Main.java
public static boolean isNetworkConnected(Context paramContext) { return ((ConnectivityManager) paramContext.getSystemService(Context.CONNECTIVITY_SERVICE)) .getActiveNetworkInfo() != null; }
From source file:Main.java
public static boolean checkNetWork(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager.getActiveNetworkInfo() != null) { return connectivityManager.getActiveNetworkInfo().isAvailable(); }//from w w w . j av a 2 s .com return false; }
From source file:Main.java
public static boolean isWifiConnect(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkINfo = cm.getActiveNetworkInfo(); if (networkINfo != null && networkINfo.getType() == ConnectivityManager.TYPE_WIFI) { return true; }/*from ww w . j ava 2s .c om*/ return false; }
From source file:Main.java
public static boolean isConnected(final Context context) { final ConnectivityManager connectManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); return connectManager.getActiveNetworkInfo().isConnected(); }
From source file:Main.java
private static NetworkInfo getNetworkInfo(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); return manager.getActiveNetworkInfo(); }