title: Android: Force close the app in Application class
body: <p>I have a class which extends Application class. In this class I am checking Internet Connectivity and calling the web service.</p>
  
  <p>Below is the method I am using to check:</p>
  
  <pre><code>public static boolean isInternetConnected(Context mContext) {
          ConnectivityManager connec = (ConnectivityManager) mContext
                  .getSystemService(Context.CONNECTIVITY_SERVICE);
  
          if (connec != null
                  &amp;&amp; (connec.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED)
                  || (connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED)) {
              return true;
          }
          return false;
  
      }
  </code></pre>
  
  <p>When there is no Internet connection I want to force close the application. How to do it?</p>
  
  <p>I have an alternative solution. If there is no Internet connection, I can skip calling api process and wait for the first activity to start and finish that activity as soon as it starts.</p>
  
  <p>Is it possible to do it in Application class?</p>