是否可以使用Android SDK将短信保存在草稿中 [英] Is it possible to save sms in drafts using Android sdk

查看:134
本文介绍了是否可以使用Android SDK将短信保存在草稿中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Android开发非常陌生。我需要你澄清一下。我的问题是是否可以以编程方式在草稿器中存储短信的数量?。
请帮助我。

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.

谢谢,
Sekhar Bethalam。

Thank you, Sekhar Bethalam.

推荐答案

是的,您可以将消息另存为草稿,执行此操作的代码如下:

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

快乐的编码!

这篇关于是否可以使用Android SDK将短信保存在草稿中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆