How do I save a message in the SMS inbox? I want to put/save a message in the SMS inbox. How do I do that? The following code found in one of the posts here does not work:-
ContentValues cv = new ContentValues();
cv.put("address", number);
.
.
.
getContextResolver().insert("content://sms/inbox", cv);
Actually it inserts the records in one of the tables ("sms") in the mmssms.db. But it seems that there are other tables to be synced up. So the message does not appear in the sms inbox in the messaging app.
What is the correct way to insert a message in the sms inbox?
Your help highly appreciated.
It is really weird. The following code (which I had tried earlier) works:
ContentVa开发者_开发问答lues values = new ContentValues();
values.put("address", sender);
values.put("body", msgBody);
values.put("date", rcvdDateTime);
getContentResolver().insert(Uri.parse("content://sms/inbox"), values);
Except that the date does not get updated. The date is always set to Jan 16, 1970. Anybody know a way to save the date too?
It is really weird. The following code (which I had tried earlier) works:-
ContentValues values = new ContentValues();
values.put("address", sender);
values.put("body", msgBody);
values.put("date", rcvdDateTime);
getContentResolver().insert(Uri.parse("content://sms/inbox"), values);
Make sure that the date value is of type long.
精彩评论