Is it possible to save sms in drafts using Android sdk

爱⌒轻易说出口 提交于 2019-12-03 20:14:34

Yes, you can save a message as a draft, the code to do this is below:

//Store the message in the draft folder so that it shows in Messaging apps.
ContentValues values = new ContentValues();
// Message address.
values.put("address", address); 
// Message body.
values.put("body", messagebody);
// Date of the draft message.
values.put("date", String.valueOf(System.currentTimeMillis())); 
values.put("type", "3");
// Put the actual thread id here. 0 if there is no thread yet.
values.put("thread_id", "0"); 
getContentResolver().insert(Uri.parse("content://sms/draft"), values);

Happy coding!

Do you mean you're making an SMS app and you want to save message drafts? That is 100% your problem. You are totally free to save drafts however you want. There is practically no Android assistance to texting beyond delivering the intent that contains the text and sending the text out for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!