title: Check Gprs Connection
body: <p>I want to check whether the gprs connection is active or not in android through code to show 
  how can i check that.
  i have the following code.
  Will it work?</p>
  
  <pre><code>public static boolean isOnline(Context context) {
  try {
  ConnectivityManager cm = (ConnectivityManager) context
  .getSystemService(Context.CONNECTIVITY_SERVICE);
  if (cm.getActiveNetworkInfo().isConnectedOrConnecting()) {
  URL url = new URL("https://telemeter4tools.services.telenet.be/TelemeterService");
  HttpURLConnection urlc = (HttpURLConnection) url
  .openConnection();
  urlc.setRequestProperty("User-Agent", "My Android Demo");
  urlc.setRequestProperty("Connection", "close");
  urlc.setConnectTimeout(1000); // mTimeout is in seconds
  
  urlc.connect();
  
  if (urlc.getResponseCode() == 200) {
  return true;
  } else {
  return false;
  }
  }
  } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  return false;
  }
  </code></pre>
  
  <p>can i replace that site with the google
  and check the response.</p>