4

I send an sms via the SmsManager API as follows:

PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent("SMS_SENT"), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent("SMS_DELIVERED"), 0);
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phone, null, formattedMessage, sentPI, deliveredPI);

I receive the SMS in the inbox, but the sent sms does not appear in the sent folder - so currently I add it manually via:

// store the sent sms in the sent folder (that shouldn't be necessary?!)
ContentValues values = new ContentValues();
values.put("address", phone);
values.put("body", formattedMessage);
context.getContentResolver().insert(Uri.parse("content://sms/sent"), values);

But I'm curious if this is really necessary and the right way to do it. I am wondering, why would the message sent via sms manager not appear in the SENT folder automatically. Is that the right way to add it there manually?

(I probably should hang the manual saving procedure into a broadcast receiver, so I only store it if the delivery was successful - but that's not part of the question at the moment).

I found this thread on the Android google group, but is this really the only way to go?

http://groups.google.com/group/android-developers/browse_thread/thread/a3c581689d0db6e1/a1acf6d990ecce52?lnk=gst&q=sms+sent#a1acf6d990ecce52

1 Answer 1

2

See How to insert sms into sent folder on android

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.