is Fast Mobile Network - Android android.telephony

Android examples for android.telephony:TelephonyManager

Description

is Fast Mobile Network

Demo Code

import android.content.Context;
import android.telephony.TelephonyManager;

public class Main {

  public static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    switch (telephonyManager.getNetworkType()) {
    case TelephonyManager.NETWORK_TYPE_1xRTT:
      return false; // ~ 50-100 kbps
    case TelephonyManager.NETWORK_TYPE_CDMA:
      return false; // ~ 14-64 kbps
    case TelephonyManager.NETWORK_TYPE_EDGE:
      return false; // ~ 50-100 kbps
    case TelephonyManager.NETWORK_TYPE_EVDO_0:
      return true; // ~ 400-1000 kbps
    case TelephonyManager.NETWORK_TYPE_EVDO_A:
      return true; // ~ 600-1400 kbps
    case TelephonyManager.NETWORK_TYPE_GPRS:
      return false; // ~ 100 kbps
    case TelephonyManager.NETWORK_TYPE_HSDPA:
      return true; // ~ 2-14 Mbps
    case TelephonyManager.NETWORK_TYPE_HSPA:
      return true; // ~ 700-1700 kbps
    case TelephonyManager.NETWORK_TYPE_HSUPA:
      return true; // ~ 1-23 Mbps
    case TelephonyManager.NETWORK_TYPE_UMTS:
      return true; // ~ 400-7000 kbps
    case TelephonyManager.NETWORK_TYPE_IDEN:
      return false; // ~25 kbps

    case TelephonyManager.NETWORK_TYPE_UNKNOWN:
      return false;
    default://from w  ww . j av a2  s  . c  o  m
      return false;
    }
  }

}

Related Tutorials