title: Check Network and Internet Connection - Android
body: <p>I was wondering if the method below check that I am both connected to a network, and can actually connected to the internet as well.</p>
  
  <p>Not just connected to a network that won't let me access the internet ?</p>
  
  <pre><code>public boolean isNetworkAvailable() {
      ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
      NetworkInfo networkInfo = manager.getActiveNetworkInfo();
  
      boolean isAvailable = false;
      if (networkInfo != null &amp;&amp; networkInfo.isConnected()) {
          isAvailable = true;
      }
      return isAvailable;
  }
  </code></pre>
  
  <p>I think, it does but I am not 100% sure.</p>
  
  <p>Thanks</p>