code: private static int getMobileNetworkClass(int networkType) {
          switch (networkType) {
              case TelephonyManager.NETWORK_TYPE_GPRS:
              case TelephonyManager.NETWORK_TYPE_EDGE:
              case TelephonyManager.NETWORK_TYPE_CDMA:
              case TelephonyManager.NETWORK_TYPE_1xRTT:
              case TelephonyManager.NETWORK_TYPE_IDEN:
                  return NETWORK_CLASS_2G;
              case TelephonyManager.NETWORK_TYPE_UMTS:
              case TelephonyManager.NETWORK_TYPE_EVDO_0:
              case TelephonyManager.NETWORK_TYPE_EVDO_A:
              case TelephonyManager.NETWORK_TYPE_HSDPA:
              case TelephonyManager.NETWORK_TYPE_HSUPA:
              case TelephonyManager.NETWORK_TYPE_HSPA:
              case TelephonyManager.NETWORK_TYPE_EVDO_B:
              case TelephonyManager.NETWORK_TYPE_EHRPD:
              case TelephonyManager.NETWORK_TYPE_HSPAP:
                  return NETWORK_CLASS_3G;
              case TelephonyManager.NETWORK_TYPE_LTE:
                  return NETWORK_CLASS_4G;
              default:
                  return NETWORK_CLASS_UNKNOWN;
          }
      }
docs: {@link TelephonyManager#getNetworkClass}