title: Android LocalBroadcastManger not always receive data
body: <p>I have a fragment with <code>TextView</code>. From the different places of my app I want to update that <code>TextView</code>, so I'm using <code>LocalBroadcastManager</code> but it is not always working - In fact when I disable device administrator (this is MDM app) it 'forget' to receive data...</p>
  <pre><code>    public static void sendMessage(String message) {
          MESSAGE = message;
          Intent intent = new Intent(MESSAGE_INTENT_FILTER);
          intent.putExtra(MESSAGE_EXTRA, message);
          App.getAppContext().sendBroadcast(intent);
      }
  </code></pre>
  <p><code>App.getAppContext()</code> is a static context declared in my Application class.</p>
  <pre><code>@Override
  public void onResume() {
      super.onResume();
      updateStatus(MESSAGE);
  }
  </code></pre>
  <p>In <code>onResume()</code> I'm updating stored message (because my fragment isn't always appeared.</p>
  <p>my Receiver:</p>
  <pre><code>    receiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
              String message = intent.getStringExtra(MESSAGE_EXTRA);
              updateStatus(message);
          }
      };
  </code></pre>
  <p>onStart / onStop:</p>
  <pre><code>@Override
  public void onStart() {
      super.onStart();
      initReceiver();
      IntentFilter intentFilter = new IntentFilter(MESSAGE_INTENT_FILTER);
      LocalBroadcastManager.getInstance(App.getAppContext()).registerReceiver(receiver, intentFilter);
  }
  
  @Override
  public void onStop() {
      super.onStop();
      LocalBroadcastManager.getInstance(App.getAppContext()).unregisterReceiver(receiver);
  }
  </code></pre>
  <p>my logs:</p>
  <blockquote>
  <p>on start fragment</p>
  <p>on resume fragment - message: Message 1</p>
  <p>update status - message: Message 1</p>
  <p>send message: Message 2</p>
  <p>on stop fragment</p>
  <p>on start fragment</p>
  <p>on resume fragment - message: Message 2</p>
  <p>update status - message: Message 2</p>
  <p><strong>DISABLED ADMIN</strong></p>
  <p>send message: Cancel</p>
  </blockquote>
  <p>And thats it... no more receive</p>