I want to send an sms message. If the text is too long, I divided it into several posts. I am trying to add additional information to the "sent" intention to find out which part was sent, and when all the parts are completed:
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 will catch the intention when sending each part, but it always has the same data. For example, "partIndex" is always zero, although it must be one for the second message. It seems that the same intention rushes all the time at my broadcast receiver. What is the right way to do this?
thank
android
Mark Dec 30 '09 at 20:58 2009-12-30 20:58
source share