Is it possible to save sms in drafts using Android sdk

故事扮演 提交于 2019-12-05 03:36:40

问题


I am very new to Android development. I need some clarifications from you. My question is 'Is it possible to store no.of sms's in drafter programatically?". Please help me.

Thank you, Sekhar Bethalam.


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/4592966/is-it-possible-to-save-sms-in-drafts-using-android-sdk

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