List of usage examples for android.net ConnectivityManager TYPE_MOBILE
int TYPE_MOBILE
To view the source code for android.net ConnectivityManager TYPE_MOBILE.
Click Source Link
From source file:Main.java
public static boolean isMobileAvailable(Context context) { int type = ConnectivityManager.TYPE_MOBILE; return isAvailableByType(context, type); }
From source file:Main.java
public static String convertActiveConnectivityType(int type) { switch (type) { case ConnectivityManager.TYPE_MOBILE: return "MOBILE"; case ConnectivityManager.TYPE_WIFI: return "WiFi"; default:/*from w ww .ja va 2 s . c om*/ return UNKNOWN; } }
From source file:Main.java
public static boolean isMobile(Context context) { NetworkInfo info = getNetworkInfo(context); return null != info && info.getType() == ConnectivityManager.TYPE_MOBILE; }
From source file:Main.java
static public boolean isMobileConnectivity(Context context) { int netType = getNetType(context); return (netType == ConnectivityManager.TYPE_MOBILE); }
From source file:Main.java
public static boolean isMobileConnected(Context context) { NetworkInfo net = getConnectivityManager(context).getActiveNetworkInfo(); return net != null && net.getType() == ConnectivityManager.TYPE_MOBILE && net.isConnected(); }
From source file:Main.java
private static int isConnectionFast(int type, int subType) { if (type == ConnectivityManager.TYPE_WIFI) { return 0; } else if (type == ConnectivityManager.TYPE_MOBILE) { switch (subType) { case TelephonyManager.NETWORK_TYPE_1xRTT: return 1; // ~ 50-100 kbps case TelephonyManager.NETWORK_TYPE_CDMA: return 2; // ~ 14-64 kbps case TelephonyManager.NETWORK_TYPE_EDGE: return 3; // ~ 50-100 kbps case TelephonyManager.NETWORK_TYPE_GPRS: return 4; // ~ 100 kbps case TelephonyManager.NETWORK_TYPE_EVDO_0: return 5; // ~25 kbps case TelephonyManager.NETWORK_TYPE_LTE: return 6; // ~ 400-1000 kbps case TelephonyManager.NETWORK_TYPE_EVDO_A: return 7; // ~ 600-1400 kbps case TelephonyManager.NETWORK_TYPE_HSDPA: return 8; // ~ 2-14 Mbps case TelephonyManager.NETWORK_TYPE_HSPA: return 9; // ~ 700-1700 kbps case TelephonyManager.NETWORK_TYPE_HSUPA: return 10; // ~ 1-23 Mbps case TelephonyManager.NETWORK_TYPE_UMTS: return 11; // ~ 400-7000 kbps case TelephonyManager.NETWORK_TYPE_EHRPD: return 12; // ~ 1-2 Mbps case TelephonyManager.NETWORK_TYPE_EVDO_B: return 13; // ~ 5 Mbps case TelephonyManager.NETWORK_TYPE_HSPAP: return 14; // ~ 10-20 Mbps case TelephonyManager.NETWORK_TYPE_IDEN: return 15; // ~ 10+ Mbps case TelephonyManager.NETWORK_TYPE_UNKNOWN: default:/*from w w w.j a v a 2s . c o m*/ return -1; } } else { return -1; } }
From source file:Main.java
public static boolean isMobileDataConnection(Context context) { try {//from w w w. j a v a 2 s . c o m ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE); return (cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_MOBILE); } catch (Exception e) { } return false; }
From source file:Main.java
public static boolean isMobileConnected(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); return (networkInfo != null && networkInfo.isConnected()); }
From source file:Main.java
public static boolean isNetworkAvailable(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); NetworkInfo wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mobile.isConnected() || wifi.isConnected()) { return true; } else {/*from ww w . ja v a2s . c o m*/ return false; } }
From source file:Main.java
private static boolean isMOBILEConnection(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (networkInfo != null) { return networkInfo.isConnected(); }/*from www.jav a2 s .co m*/ return false; }