Here is how I check if the Android device is connected to a Wi-Fi network:

```
NetworkInfo info = ((ConnectivityManager) ctx.getSystemService(Context
         .CONNECTIVITY_SERVICE)).getNetworkInfo(ConnectivityManager.TYPE_WIFI);
boolean isWifiConnected = info != null && info.isAvailable() && info.isConnected();

```

This works perfectly on all versions prior to Android 6.0.
However, on Android 6.0, if the device is connected to a Wi-Fi without Internet access, info.isConnected() returns false.

So, how can I know for sure that the device is connected to a Wi-Fi on Android 6.0?