title: onReceive not getting called when SMS data is sent
body: <p>I am creating an app on android that needs to be able to allow android devices to send SMS data back and forth with SmsManager.sendDataMessage(). For some reason when I try to send data this way my sms receiver doesn't ever get anything. What am I missing? </p>
  
  <p>Here is the code to send the data:</p>
  
  <pre><code>SmsManager sm = SmsManager.getDefault();
  sm.sendDataMessage(toPhone, null, (short)8901, message.getBytes(), null, null);
  </code></pre>
  
  <p>Here is the code to my sms receiver:</p>
  
  <pre><code>import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.telephony.SmsMessage;
  
  public class DataReceiver extends BroadcastReceiver
  {
      private String myMessage;
  
      @Override
      public void onReceive(Context context, Intent intent)
      {
          Bundle bundle = intent.getExtras();
          if (bundle == null) return;
  
          Object[] objs = (Object[]) bundle.get("pdus");
          SmsMessage[] messages = new SmsMessage[objs.length];
  
          for (int i = 0; i &lt; objs.length; i++)
          {
              messages[i] = SmsMessage.createFromPdu((byte[]) objs[i]);
          }
  
          for (SmsMessage currMessage : messages)
          {
              if (!currMessage.isStatusReportMessage())
              {
                  String messageBody = currMessage.getDisplayMessageBody();
                  byte[] messageBytes = currMessage.getPdu();
                  int x = 1 + messageBytes[0] + 19 + 7;
                  myMessage = new String(messageBytes, x, messageBytes.length - x);
                  System.out.printf(myMessage);
              }
          }
      }
  }
  </code></pre>
  
  <p>Here is what I have in my manifest for the receiver:</p>
  
  <pre><code>&lt;receiver android:name=".DataReceiver"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.DATA_SMS_RECEIVED" /&gt;
          &lt;data android:scheme="sms" /&gt;
          &lt;data android:host="localhost" /&gt;
          &lt;data android:port="8901" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>And here are the permissions I am using:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  </code></pre>