public MobileNetworkType getMobileNetworkType() {

    if (connectivityStatus != ConnectivityStatus.MOBILE_CONNECTED) {
      return MobileNetworkType.UNKNOWN;
    }

    TelephonyManager telephonyManager =
        (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    switch (telephonyManager.getNetworkType()) {
      case (TelephonyManager.NETWORK_TYPE_LTE):
        return MobileNetworkType.LTE;
      case (TelephonyManager.NETWORK_TYPE_HSPAP):
        return MobileNetworkType.HSPAP;
      case (TelephonyManager.NETWORK_TYPE_EDGE):
        return MobileNetworkType.EDGE;
      case (TelephonyManager.NETWORK_TYPE_GPRS):
        return MobileNetworkType.GPRS;
      default:
        return MobileNetworkType.UNKNOWN;
    }
  }
Event pushed to Otto Event Bus when ConnectivityStatus changes;
E.g. when WiFi is turned on or off or when mobile network is turned on or off
it also occurs when WiFi is on, but there is no Internet connection or when there is Internet
connection
or when device goes off-line
network-events-library/src/main/java/com/github/pwittchen/networkevents/library/event/ConnectivityChanged.java