title: Intent action for network events in android sdk
body: <p>I need to receive broadcasts for network actions like network connected, disconnected etc. I am using a broadcast receiver for this purpose. Can anyone please tell me which intent action I need to capture for network events, right now as per my search on internet I am using <strong>android.net.ConnectivityManager.CONNECTIVITY_ACTION</strong>. </p>
  
  <p>Here is my broadcast receiver class:</p>
  
  <pre><code>import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  
  public class NetworkStateReceiver extends BroadcastReceiver {
  
  @Override
  public void onReceive(Context context, Intent intent) {
      // TODO Auto-generated method stub
  
  
      if (intent.getAction().equals(
              android.net.ConnectivityManager.CONNECTIVITY_ACTION)) {
  
          // do something..
      }
  }
  }
  </code></pre>
  
  <p>and I have also added permission for accessing network state:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  </code></pre>
  
  <p>here is how I have declared this class in manifest file</p>
  
  <pre><code>&lt;receiver class=".NetworkStateReceiver" android:name=".NetworkStateReceiver"&gt;
      &lt;intent-filter&gt;
              &lt;action android:name="android.net.ConnectivityManager.CONNECTIVITY_ACTION" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>Please suggest me the right intent action if I am wrong OR if there is any other way to catch network events.</p>