android – 通过SmsManager发送的短信不会自动发送到SENT文件夹中?

我通过SmsManager API发送短信,如下所示:

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);

我在收件箱中收到短信,但发送的短信没有出现在已发送的文件夹中 – 所以目前我通过以下方式手动添加:

// 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);

但我很好奇这是否真的有必要并且是正确的方法.我想知道,为什么通过短信管理器发送的消息不会自动出现在SENT文件夹中.这是手动添加它的正确方法吗?

(我可能应该将手动保存程序挂起到广播接收器中,所以我只在交付成功时才存储它 – 但这不是目前问题的一部分).

我在Android谷歌群上发现了这个帖子,但这真的是唯一的出路吗?

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

最佳答案 见
How to insert sms into sent folder on android

点赞