I'm noticing the tracking pending intents that I send out via the standard SmsManager in Android doesn't seem to retain the extra information in them. Example:
Intent sentIntent = new Intent(SENT);
sentIntent.putExtra("value1", "foo"); // <- note this value
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, sentIntent, 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(numberToSendTo, null, mMessageToSend, sentPI, null);
//... in the broadcastReceiver that catches the SENT intent ...
public void onReceive(Context arg0, Intent arg1) {
arg1.getExtras().getString("value1"); // <- nothing, no such key
}
Can someone test this out, was this behaviour intended and I am doing it wrong, or is this a bug to be filed for Android?
Try adding the flag
FILL_IN_SELECTOR
when you create the PendingIntent (see the spec forPendingIntent.getBroadcast
for the flags and their general behavior). This should force thePendingIntent
to take in all the top-level extras from theIntent
.