我有以下代码:
它不会保存到我的收件箱
try{
Bundle bundle = intent.getExtras();
String message = bundle.getString("message");
String pnumber = bundle.getString("number");
String time = bundle.getString("timestamp");
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(pnumber, null, message, null, null);
Toast.makeText(context,"Message Sent to " + pnumber,
Toast.LENGTH_SHORT).show();
ContentValues my_values = new ContentValues();
my_values.put("body", message);
my_values.put("address", pnumber);
context.getContentResolver().insert(Uri.parse("content://sms/sent"), my_values);
}
catch(Exception e){
Toast.makeText(context, "Error but Received!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
请帮我如何保存此发送的短信
答案 0 :(得分:0)
如果您想在INBOX中保存,则需要设置Uri:content://sms/inbox
。在您的示例中 - "content://sms/sent"