title: In BroadcastReceiver, getResultCode() always returns -1 for SMS sent and delivered actions
body: <p>Following most people I guess, I am deriving my SMS handling code from <a href="http://mobiforge.com/developing/story/sms-messaging-android" rel="nofollow">http://mobiforge.com/developing/story/sms-messaging-android</a>. I am trying to catch the broadcasts for sent and delivered messages, with this code (for sent messages):</p>
  
  <pre><code>        appContext.registerReceiver(new BroadcastReceiver() {
              @Override
              public void onReceive(Context arg0, Intent arg1) {
                  Log.i("Debug",
                          "My embedded receiver: "
                                  + String.valueOf(getResultCode()));
              }
          }, new IntentFilter("iam.applications.SmsReceiver.SMS_SENT"));
  </code></pre>
  
  <p>This always results in getResultCode() returning a value of -1, even when the SMS is successfully sent. I don't know of another way to tell whether my SMS was sent or not.</p>
  
  <p>I have also subclassed BroadcastReceiver to see if that makes any difference, but it does not. -1 is always returned:</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent intent) {
      String action = intent.getAction();
  
      Log.i("Debug",
              "Result code in onReceive: " + String.valueOf(getResultCode()));
  }
  </code></pre>
  
  <p>My creation of the PendingIntent looks like this (snippet from a for-loop for processing parts of long SMS messages):</p>
  
  <pre><code>        Intent sentIntent = new Intent(
                  "iam.applications.SmsReceiver.SMS_SENT");
          sentIntent.putExtra(SmsHandler.PHONE_NUMBER, phoneNumber);
          sentIntent.putExtra(SmsHandler.MESSAGE, message);
          sentPIArray.add(PendingIntent.getBroadcast(appContext,
                  (int) Calendar.getInstance().getTimeInMillis(), sentIntent,
                  PendingIntent.FLAG_UPDATE_CURRENT));
  </code></pre>