title: Broadcast Receiver not working for SMS
body: <p>First of all I already searched for possible solutions, tried everything and it still didn't work. I must be missing something.</p>
  
  <p>I am trying to create an app that receives/reads and writes SMS.
  the write part is working just fine, my broadcast receiver just doesn't catch broadcast.</p>
  
  <h2>AndroidManifest.xml</h2>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_SMS" /&gt; 
      &lt;uses-permission android:name="android.permission.READ_SMS" /&gt; 
  ...
          &lt;receiver android:name=".SmsReceiver"
              android:permission="android.permission.BROADCAST_SMS"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
          &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  </code></pre>
  
  <h2>SmsReceiver.java</h2>
  
  <pre><code>public class SmsReceiver extends BroadcastReceiver {
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      Toast.makeText(context, "ON RECEIVE BROADCAST", Toast.LENGTH_LONG).show();
      Log.d("ON ","RECEIVE");
       Bundle bundle = intent.getExtras();
          Object[] messages = (Object[]) bundle.get("pdus");
          SmsMessage[] sms = new SmsMessage[messages.length];
          // Create messages for each incoming PDU
          for (int n = 0; n &lt; messages.length; n++) {
              sms[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
          }
          for (SmsMessage msg : sms) {
              Log.e("RECEIVED MSG",":"+msg.getMessageBody());
              // Verify if the message came from our known sender
  
          }
  }
  </code></pre>
  
  <p>none of the Logs or toasts are fired.</p>
  
  <p>Tried changing action on manifest to <code>android.intent.action.AIRPLANE_MODE</code> just to test the declaration and the broadcast was received, is just not working for the SMS.</p>
  
  <h2>UPDATED</h2>
  
  <p>Tried on a different phone and it worked. Must be because I am using Handcent SMS, and some how its blocking the broadcast. Either way I need it to be working on every phone independent of the applications installed.</p>