title: BroadcastReceiver not firing for network connection changes
body: <p>I'm trying to listen for changes in network connectivity. My broadcast receiver doesn't seem to be firing when I switch in or out of airplane mode. I'm not sure if this is because I don't have it registered correctly or if maybe airplane mode changes don't cause this to fire. Any advice is appreciated. Thanks!</p>
  
  <p>My manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt;
  
  &lt;receiver android:name=".NetworkReceiver" &gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>My broadcast receiver class:</p>
  
  <pre><code>public class NetworkReceiver extends BroadcastReceiver {
  
      private SharedPreferences prefs;
      private SharedPreferences.Editor prefEditor;
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          prefs = PreferenceManager.getDefaultSharedPreferences(context);
          prefEditor = prefs.edit();
  
          Boolean has_connection = prefs.getBoolean("has_connection", false);
          prefEditor.putBoolean("has_connection", !has_connection);
          prefEditor.commit();
  
          System.err.println("Network Receiver notified of a connectivity change!");
          System.err.println("New has_connection: " + !has_connection);
  
      }
  
  }
  </code></pre>
  
  <p>Also, after the app runs for about 45 seconds, it suddenly crashes with the following error:</p>
  
  <pre><code>09-06 21:29:48.775: E/AndroidRuntime(15613): java.lang.RuntimeException: Unable to instantiate receiver com.mysite.myapp.NetworkReceiver: java.lang.ClassNotFoundException: com.mysite.myapp.NetworkReceiver
  </code></pre>