title: BroadcastReceiver.onReceive call many times
body: <p>I has two version <code>debug</code>, and <code>release</code>.</p>
  
  <p>Here structures:</p>
  
  <pre><code>app/src/main/java/com/myproject/app/fragment/PaidInvoicesBaseFragment.java
  </code></pre>
  
  <p>Snippet:</p>
  
  <pre><code>public class PaidInvoicesBaseFragment extends Fragment {
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
  simpleCursorAdapter = new InvoiceAdapter(getActivity(), R.layout.invoice_list_item, null, dataColumnsNames,
                  viewIDs, 0);
  }
  
    @Override
      public void onResume() {
          super.onResume();     
          initLogic();
      }
  
      protected void initLogic() {
  
          IntentFilter intentFilter = new IntentFilter(NotificationsSyncModule.SYNC_ACTION);
          intentFilter.setPriority(NotificationsSyncModule.FRAGMENT_PRIORITY);
  
          getActivity().registerReceiver(mMessageReceiver, intentFilter);
  
  }
  
  @Override
      public void onPause() {
          super.onPause();
          getActivity().unregisterReceiver(mMessageReceiver);
          LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
  }
  </code></pre>
  
  <p><code>InvoiceAdapter</code> is in : </p>
  
  <pre><code>app/src/main/java/com/myproject/app/widget/adapter/InvoiceAdapter.java
  </code></pre>
  
  <p>Here snippet:</p>
  
  <pre><code>public class InvoiceAdapter extends SimpleCursorAdapter {
  
  imageViewLargeSendPostalOffice.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View arg0) {
                      Intent intent = new Intent();
                      intent.setAction(SEND_POSTAL_OFFICE);
  
                      LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
                  }
              });
  }
  </code></pre>
  
  <p>Here dubug version:</p>
  
  <pre><code>/app/src/debug/java/com/myproject/app/fragment/PaidInvoicesFragment.java
  </code></pre>
  
  <p>Snippet:</p>
  
  <pre><code>public class PaidInvoicesFragment extends PaidInvoicesBaseFragment {
  
      @Override
      protected void initLogic() {
          IntentFilter intentFilterSendPostalOffice = new IntentFilter(InvoiceAdapter.SEND_POSTAL_OFFICE);
          LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver,
                  intentFilterSendPostalOffice);
  
          super.initLogic();
      }
  
      private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
              String action = intent.getAction();
              if (action.equals(InvoiceAdapter.SEND_POSTAL_OFFICE)) {
                  showConfirmDialogSendPostalOffice();
              }
          }
      };
  </code></pre>
  
  <p>When I click on <code>imageViewLargeSendPostalOffice</code> in <code>InvoiceAdapter</code> then it send broadcast <code>SEND_POSTAL_OFFICE</code>.
  As result in <code>PaidInvoicesFragment</code> receive this broadcast.</p>
  
  <p>Nice.It's work fine... with one exception.</p>
  
  <p>When <code>PaidInvoicesFragment</code> is show and I minimize app and then return to app again and then click on <code>imageViewLargeSendPostalOffice</code> the method</p>
  
  <pre><code>LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
  </code></pre>
  
  <p>is call once, but  in <code>PaidInvoicesFragment onReceive(Context context, Intent intent)</code> call <strong>twice</strong>.</p>
  
  <p>If I e.g. minimize app 2 times then <code>onReceive(Context context, Intent intent)</code> call 4 times.
  If I e.g. minimize app 3 times then <code>onReceive(Context context, Intent intent)</code> call 6 times.
  And so on.</p>
  
  <p>But I need to <code>onReceive(Context context, Intent intent)</code> to call only once.</p>