List of usage examples for android.net ConnectivityManager TYPE_WIMAX
int TYPE_WIMAX
To view the source code for android.net ConnectivityManager TYPE_WIMAX.
Click Source Link
From source file:Main.java
public static boolean isChargeFreeNetworkAvailable(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = manager.getActiveNetworkInfo(); return (activeNetworkInfo != null && activeNetworkInfo.isConnected() && (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIMAX || activeNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET)); }
From source file:com.air.mobilebrowser.NetworkUtil.java
/** * Check the current status of internet connectivity. * This method iterates over the available network interfaces and * checks for an active connection.//w ww . j a v a 2 s. co m * @return true if a connection was detected, false otherwise. */ public static boolean haveInternetConnection(Context context) { if (context != null) { ConnectivityManager connectivityMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifiInfo = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); NetworkInfo mobile = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); NetworkInfo wimax = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_WIMAX); NetworkInfo blue = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_BLUETOOTH); NetworkInfo ether = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); boolean hasInternet = false; if (wifiInfo != null && wifiInfo.getState() == NetworkInfo.State.CONNECTED) { hasInternet = true; } else if (mobile != null && mobile.getState() == NetworkInfo.State.CONNECTED) { hasInternet = true; } else if (wimax != null && wimax.getState() == NetworkInfo.State.CONNECTED) { hasInternet = true; } else if (blue != null && blue.getState() == NetworkInfo.State.CONNECTED) { hasInternet = true; } else if (ether != null && ether.getState() == NetworkInfo.State.CONNECTED) { hasInternet = true; } return hasInternet; } return false; }
From source file:net.zionsoft.obadiah.model.utils.AppUpdateChecker.java
@Override protected void onHandleIntent(Intent intent) { try {/*from w w w. j av a 2 s . co m*/ // we only check if at least 24 hours is passed final SharedPreferences preferences = getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); final long now = System.currentTimeMillis(); final long lastCheckedTimestamp = preferences .getLong(Constants.PREF_KEY_CHECKED_APPLICATION_VERSION_TIMESTAMP, 0); if (now - lastCheckedTimestamp < DateUtils.DAY_IN_MILLIS) { return; } // we only check if the user has active WiFi or WiMAX final NetworkInfo networkInfo = ((ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE)) .getActiveNetworkInfo(); if (networkInfo == null || !networkInfo.isConnected()) { return; } final int networkType = networkInfo.getType(); if (networkType != ConnectivityManager.TYPE_WIFI && networkType != ConnectivityManager.TYPE_WIMAX) { return; } final String response = new String(NetworkHelper.get(NetworkHelper.CLIENT_VERSION_URL), "UTF-8"); final JSONObject versionObject = new JSONObject(response); final int latestVersion = versionObject.getInt("versionCode"); final SharedPreferences.Editor editor = preferences.edit(); if (latestVersion < preferences.getInt(Constants.PREF_KEY_CHECKED_APPLICATION_VERSION, 0)) { editor.putInt(Constants.PREF_KEY_CHECKED_APPLICATION_VERSION, latestVersion) .putBoolean(Constants.PREF_KEY_ASKED_APPLICATION_UPDATE, false); } editor.putLong(Constants.PREF_KEY_CHECKED_APPLICATION_VERSION_TIMESTAMP, now).apply(); } catch (Exception e) { Crashlytics.logException(e); } }
From source file:com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidConnectivity.java
private void determineAvailability() { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); inAirplaneMode = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;//from w w w .jav a2s .c om log.info("Airplane mode: " + inAirplaneMode); final NetworkInfo networkInfo = cm != null ? cm.getActiveNetworkInfo() : null; int networkType = 0; // default state hasWifi = false; // when we have connectivity manager, we assume we have some sort of // connectivity hasMobile = cm != null; // can we obtain network info? if (networkInfo != null) { if (networkInfo.isConnectedOrConnecting()) { networkType = networkInfo.getType(); hasWifi = networkType == ConnectivityManager.TYPE_WIFI || networkType == ConnectivityManager.TYPE_WIMAX; hasMobile = networkType == ConnectivityManager.TYPE_MOBILE || networkType == ConnectivityManager.TYPE_MOBILE_DUN || networkType == ConnectivityManager.TYPE_MOBILE_HIPRI || networkType == ConnectivityManager.TYPE_MOBILE_MMS || networkType == ConnectivityManager.TYPE_MOBILE_SUPL; } else { // if neither connected or connecting then hasMobile defaults // need to be changed to false hasMobile = false; } } log.info(String.format("Device Connectivity (%s)", hasWifi ? "On Wifi" : (hasMobile ? "On Mobile" : "No network connectivity"))); }
From source file:com.just.agentweb.AgentWebUtils.java
public static int checkNetworkType(Context context) { int netType = 0; //?// w w w . j a va 2s . co m ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); //?NetworkInfo @SuppressLint("MissingPermission") NetworkInfo networkInfo = manager.getActiveNetworkInfo(); if (networkInfo == null) { return netType; } switch (networkInfo.getType()) { case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_WIMAX: case ConnectivityManager.TYPE_ETHERNET: return 1; case ConnectivityManager.TYPE_MOBILE: switch (networkInfo.getSubtype()) { case TelephonyManager.NETWORK_TYPE_LTE: // 4G case TelephonyManager.NETWORK_TYPE_HSPAP: case TelephonyManager.NETWORK_TYPE_EHRPD: return 2; case TelephonyManager.NETWORK_TYPE_UMTS: // 3G case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_EVDO_B: return 3; case TelephonyManager.NETWORK_TYPE_GPRS: // 2G case TelephonyManager.NETWORK_TYPE_EDGE: return 4; default: return netType; } default: return netType; } }
From source file:dev.ukanth.ufirewall.InterfaceTracker.java
private static InterfaceDetails getInterfaceDetails(Context context) { InterfaceDetails ret = new InterfaceDetails(); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); if (info == null || info.isConnected() == false) { return ret; }//from w w w . j a va2s. com switch (info.getType()) { case ConnectivityManager.TYPE_MOBILE: case ConnectivityManager.TYPE_MOBILE_DUN: case ConnectivityManager.TYPE_MOBILE_HIPRI: case ConnectivityManager.TYPE_MOBILE_MMS: case ConnectivityManager.TYPE_MOBILE_SUPL: case ConnectivityManager.TYPE_WIMAX: ret.isRoaming = info.isRoaming(); ret.netType = ConnectivityManager.TYPE_MOBILE; ret.netEnabled = true; break; case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_BLUETOOTH: case ConnectivityManager.TYPE_ETHERNET: ret.netType = ConnectivityManager.TYPE_WIFI; ret.netEnabled = true; break; } getTetherStatus(context, ret); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { OldInterfaceScanner.populateLanMasks(context, ITFS_WIFI, ret); } else { NewInterfaceScanner.populateLanMasks(context, ITFS_WIFI, ret); } return ret; }
From source file:edu.mit.mobile.android.locast.data.CastMedia.java
/** * Attempts to guess if the video player should show a high quality version of the video or a * lower bitrate version./*from w w w . jav a 2 s . c om*/ * * @return true if it seems as though playing high-quality would be expensive or wouldn't work */ public static boolean shouldShowLowQuality(Context context) { final ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final boolean metered = ConnectivityManagerCompat.isActiveNetworkMetered(cm); final NetworkInfo net = cm.getActiveNetworkInfo(); if (metered || net == null || net.isRoaming()) { return true; } // this is because these devices tend to not be able to be powerful enough to show the full // res video if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return true; } final int type = net.getType(); switch (type) { // generally these are fast and cheap/free case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_ETHERNET: case ConnectivityManager.TYPE_WIMAX: return false; default: return true; } }
From source file:syncthing.android.service.SyncthingInstance.java
boolean isConnectedToWifi() { NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo(); return networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIMAX; }
From source file:com.shinymayhem.radiopresets.ServiceRadioPlayer.java
protected int getConnectionType() { int newState = mNetworkInfo.getType(); if (LOCAL_LOGV) { String str = ""; switch (newState) { case ConnectivityManager.TYPE_WIFI: str += "wifi"; break; case ConnectivityManager.TYPE_MOBILE: str += "mobile"; break; case ConnectivityManager.TYPE_MOBILE_DUN: str += "mobile-dun"; break; case ConnectivityManager.TYPE_MOBILE_HIPRI: str += "moblie-hipri"; break; case ConnectivityManager.TYPE_MOBILE_MMS: str += "mobile-mms"; break; case ConnectivityManager.TYPE_MOBILE_SUPL: str += "mobile-supl"; break; case ConnectivityManager.TYPE_WIMAX: str += "wimax"; break; case ConnectivityManager.TYPE_ETHERNET: str += "ethernet"; break; case ConnectivityManager.TYPE_BLUETOOTH: str += "bluetooth"; break; case ConnectivityManager.TYPE_DUMMY: str += "dummy"; break; }// ww w . ja va 2s.c o m str += " detected"; log(str, "v"); } return newState; }