title: Android, wifi wake up
body: <p>When tablet is connected by the wire (charger/usb) the wifi doesn't sleep, when the device is unpluged, the wifi goes sleep and when I ulock the screen, the Icon of  the Wifi is blue but I don't have internet connection, sometimes the icon is grey and I dont have internet too.</p>
  
  <p>I have programmed, if there is no connection and connection to the server timed out I get error, these features  work when the icon is gray, but if the icon is blue, the widget hangs on, and it again works when I turn off wifi, what is wrong?
  I think if there is blue icon it thinks that I have connection to the internet, but I have next check if server respond (3 sec) and it should works. But it thniks and thinks until turn off wifi.</p>
  
  <p>On the phone I have 2.2 and I dont have any troubles, on the tablet I've 4.0.3</p>
  
  <pre><code>wifi = conn.getNetworkInfo(ConnectivityManager.TYPE_WIFI);      
  mobile = conn.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
          if (wifi.isConnected() || mobile.isConnected()) {
              try {
                  URL url = new URL(uri);
                  HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
                  urlc.setConnectTimeout(3000);
                  urlc.connect();
                  if (urlc.getResponseCode() == 200) { 
                      return true;
                  } else { 
                      return false;
                  }
              } catch (IOException e) {
  
                  return false;
              }
          } else {
              return false;
          }
  </code></pre>