title: BroadcastReceiver SMS_Received not working on new devices
body: <p>After going through several resources and questions, I still face a problem with detecting an incoming SMS message.</p>
  
  <p>The code below shows the basics:</p>
  
  <p><strong>Broadcast receiver class that displays toast onReceive</strong></p>
  
  <pre><code>public class IncomingSms extends BroadcastReceiver {
      public void onReceive(Context context, Intent intent) {
          Toast.makeText(context, "something received", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p><strong>Simple Manifest with registering receiver and permissions</strong></p>
  
  <pre><code>&lt;application
      &lt;receiver 
          android:name=".IncomingSms"
          android:permission="android.permission.BROADCAST_SMS"
          android:exported="true"&gt;
  
          &lt;intent-filter android:priority="2147483647" &gt;
              &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
  &lt;/application&gt;
  
  &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
  </code></pre>
  
  <p>The code above declares and registers the receiver, and has proper permissions.  In addition, the priority is set to MAX_INT, or 2147483647.</p>
  
  <p>My device is Nexus 6P, with default Messenger app installed (I also tried Hangouts).  The app still does not display my toasts.  After trying on an older Samsung device, the toasts were printed properly.</p>
  
  <p><strong>Priority issue</strong></p>
  
  <p>I installed on the 6P an app called <strong>Manifest Viewer</strong>, which allows me to see the manifest.xml of apps installed on my device.  I checked the manifests of both Messenger and Hangouts, for the receiver of SMS tag, and found that both of them also specify a priority of 2147483647.  It seems like both those messenger apps max out the priority, and once they consume the message, they don't allow other applications to intervene. Note that these are stock Google apps, and not 3rd party.</p>
  
  <p>At this point, I am quite confused as to:</p>
  
  <ul>
  <li>why would they do this?</li>
  <li>how to bypass it?</li>
  </ul>
  
  <p>Thanks a lot</p>