title: Broadcast receiver in a Fragment
body: <p>I have a Broadcast receiver in my Fragment, to track any newly received SMS.</p>
  
  <pre><code>private BroadcastReceiver smsBroadcastReceiver;
  IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
  
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
      smsBroadcastReceiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
              Log.e("smsBroadcastReceiver", "onReceive");
          }
      };
  }
  
  @Override
  public void onStart() {
  super.onStart();
      LocalBroadcastManager.getInstance(getActivity()).registerReceiver(smsBroadcastReceiver, filter);
  }
  
  @Override
  public void onStop() {
      super.onStop();
      LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(smsBroadcastReceiver);
  }
  </code></pre>
  
  <p>and the permissions in the Manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
  </code></pre>
  
  <p>The problem is I never get the log <code>Log.e("smsBroadcastReceiver", "onReceive");</code>
  I definitely get the SMS while the receiver is still registered.</p>
  
  <p>However if I write the receiver as a separate class and put it in the Manifest, then it's onReceive() is called.</p>
  
  <p>Did I miss something?</p>