code: protected NetworkInfo getActiveNetworkInfo() {
          ConnectivityManager connectivityManager
                  = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
          return connectivityManager.getActiveNetworkInfo();
      }
docs: Retrieves information on the current type of network connection that the device is using