title: Issue in Unregistering broadcast receiver
body: <p>I want my app to have statically broadcast receiver because i want it to detect incoming message while the app is closed.I have added in manifest like </p>
  
  <pre><code>&lt;receiver android:name=".SMSReceiver"
          android:exported="true"
          android:enabled="true"&gt;
  
          &lt;intent-filter&gt;
              &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>now i want it to dynamically unregister by switch. when the switch is off it showed not detect incoming SMS.How i could do this. Please help me</p>