title: Broadcast Receiver is not registering in android oreo
body: <p>SmsBroadcastReceiver was not triggering when i received otp in oreo. I have explicitly registered my receiver in fragment instead of not only in manifest.</p>
  
  <pre><code>public class MyFragment extends Fragment{
     @Override
     public View onCreateView(LayoutInflater inflater,
        ViewGroup container, Bundle savedInstanceState) {
        intentFilter = new IntentFilter();
        intentFilter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION);
        smsBroadcastReceiver = new SmsBroadcastReceiver();
       getActivity().registerReceiver(smsBroadcastReceiver,intentFilter); 
        return inflater.inflate(
                R.layout.fragment_two, container, false);
     }
  }
  </code></pre>
  
  <p>Here it's my SmsReceiverBroadcast class</p>
  
  <pre><code>public class SmsBroadcastReceiver extends BroadcastReceiver {
      public SmsBroadcastReceiver() {
      }
      @Override
      public void onReceive(Context context, Intent intent) {
                 Log.d("onRecieve","Otp has been received");
              }
          } catch (Exception e) {
          }
      }
  
  }
  </code></pre>
  
  <p>And in my manifest,</p>
  
  <pre><code>&lt;receiver
                  android:name=".receiver.SmsBroadcastReceiver"
                  android:enabled="true"
                  android:exported="false"
                  &gt;
                  &lt;intent-filter&gt;
                      &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
                      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                  &lt;/intent-filter&gt;
              &lt;/receiver&gt;
  </code></pre>
  
  <p>I'm not getting any trigger in override onReceive() method for the Broadcast receiver. I have found that we need to register a broadcast receiver explicitly. I register my receiver using registerBroadcast().It is not working for me.Also, I referred <a href="https://developer.android.com/about/versions/oreo/background.html" rel="nofollow noreferrer">https://developer.android.com/about/versions/oreo/background.html</a></p>
  
  <p>I have also tried 
  Do I need to add any other permission to register and triggering the receiver whenever I receive otp?Is my intent filters action(<strong>Telephony.Sms.Intents.SMS_RECIEVED_ACTION</strong>) correct?</p>