title: ConnectivityManager to verify internet connection
body: <p>Hi all I need to verify if my device is currently connected to internet or not and so I wrote this class that uses a <code>ConnectivityManager</code> to check:</p>
  
  <pre><code>public boolean checkInternetConnection() {
  ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
  
      if (cm.getActiveNetworkInfo() != null &amp;&amp; cm.getActiveNetworkInfo().isAvailable() &amp;&amp; cm.getActiveNetworkInfo().isConnected()) {
          return true;
  
      } else {
          return false;
      }
  }
  </code></pre>
  
  <p>works great, because right now the method is in a class in the main package (<code>com.App</code>), but how should I change the code to make it work in a class defined in <code>com.App.Utility</code> ?</p>
  
  <p>Thanks! </p>