code: public NetworkConnectionType getCurrentConnectionType() {
          NetworkInfo activeNetworkInfo = getActiveNetworkInfo();
  
          if (activeNetworkInfo == null || !isInternetAccessAvailable()) {
              return NetworkConnectionType.NO_CONNECTION;
          }
          switch (activeNetworkInfo.getType()) {
              case ConnectivityManager.TYPE_WIFI:
                  return NetworkConnectionType.WIFI;
              case ConnectivityManager.TYPE_MOBILE:
                  return NetworkConnectionType.MOBILE;
              case ConnectivityManager.TYPE_WIMAX:
                  return NetworkConnectionType.WIMAX;
              case ConnectivityManager.TYPE_ETHERNET:
                  return NetworkConnectionType.ETHERNET;
              default:
                  return NetworkConnectionType.NO_CONNECTION;
          }
      }
docs: Get the type of network connection that the device is currently using
  to connect to the internet.
  
  @return The type of network connection that the device is currently using.