SMS sent via SmsManager not automatically in SENT folder?
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开发者_StackOverflow.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
See How to insert sms into sent folder on android
精彩评论