Hi,
I'd like to send an sms message. If the text is too long, I split it into multiple messages. I'm trying to put some extra info into the "sent" intent to know which part has been sent, and when all the parts are complete:
ArrayList<String> messageParts = ...;
for (int i = 0; i < messageParts.size(); i++) {
sms.sendTextMessage(
address,
null,
messageParts.get(i),
generateIntent(context, messageParts.size(), i),
null));
}
PendingIntent generateIntent(Context context, int partCount, int partIndex)
{
Intent intent = new Intent("SMS_SENT");
intent.putExtra("partCount", partCount);
intent.putExtra("partIndex", partIndex);
return PendingIntent.getBroadcast(context, 0, intent, 0);
}
The message is sent, and I catch the intent when each part is sent - but the intent always has the same data in it. For example, "partIndex" is always zero, even though for the second message, it should be one. Seems like the same intent just keeps getting thrown to my broadcast receiver. What's the right way to do this?
Thanks