title: ConnectivityManager Networkcallback doesn't catch connection to wifi network with no internet connection
body: <p>I have a device to which my app can connect via WIFI, the device however doesn't have internet. I implemented a NetworkCallback to catch changes in connectivity as such:</p>
  
  <pre><code>public class ConnectivityNetworkCallback extends ConnectivityManager.NetworkCallback{
  
          @Override
          public void onAvailable(android.net.Network network) {
              super.onAvailable(network);
  
              if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M)
                  mConnectivityManager.bindProcessToNetwork(network);
              else
                  ConnectivityManager.setProcessDefaultNetwork(network);
  
              NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
              int connectionType = networkInfo.getType();
              Log.e("networkCallback", "connectionType: " + networkInfo.getTypeName());
              switch(connectionType){
  
                  case ConnectivityManager.TYPE_WIFI:
                      String networkName = networkInfo.getExtraInfo().substring(1,networkInfo.getExtraInfo().length()-1);
  
                      Log.e("networkCallback","network type wifi, extra: " + networkName);
  
                      break;
                  case ConnectivityManager.TYPE_MOBILE:
                      Log.e("networkCallback","network type mobile, extra:  " + networkInfo.getExtraInfo());
                      break;
              }
          }
  
          @Override
          public void onLost(android.net.Network network) {
              super.onLost(network);
  
              Log.e("networkCallback", "losing active connection");
          }
  }
  </code></pre>
  
  <p>When both my Wifi and mobile data is on and I switch between different wifi networks with internet access the <strong>"onAvailable()"</strong> fires and prints to log that I'm connected via wifi.
  As soon as I try to connect to a wifi network with no internet <strong>"onAvailable()"</strong> method fires and prints that I'm connected via mobile and also the device shows an exclamation mark next to the wifi icon.</p>
  
  <p>Is there a way I still can catch the case where I'm connected to a wifi network with no internet?</p>