title: ignoring duplicate duplicate broadcasts does not works
body: <p>In my android application I am sending SMS on receiving SIM_STATE_CHANGE broadcast. I have used <code>static boolean duplicate_broadcast</code> variable in my code to ignore duplicate broadcast but still I am receiving two messages on SIM_STATE_CHANGE event (when I restart my phone). I have double checked that both the broadcasts are of type <code>android.intent.action.SIM_STATE_CHANGED</code>. So please tell what is problem in my code?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>public class BroadcastHandler extends BroadcastReceiver {
  
      private static boolean duplicate_broadcast = false;
  
      @Override
      public void onReceive(Context context, Intent intent) {
          if(duplicate_broadcast ==false) {
              duplicate_broadcast = true;
              SmsManager smsManager = SmsManager.getDefault();
              smsManager.sendTextMessage("messageAddress", null, "messageBody", null, null);
          }
      }
  }
  </code></pre>
  
  <p><strong>AndroidManifest:</strong></p>
  
  <pre><code>&lt;receiver android:name=".BroadcastHandler"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.SIM_STATE_CHANGED" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>