以编程方式将彩信添加到收件箱
使用 1.5,我想以编程方式创建彩信并将其插入收件箱。
插入短信的工作代码是
ContentValues val = new ContentValues();
val.put("body", "This is test message!!");
val.put("address", "1234");
val.put("date", "1234567891204");
getContentResolver().insert(Uri.parse("content://sms/inbox"), val);
此代码正在工作,我需要相同的东西(如果可能)来插入彩信(即带有.png附件的短信)或者可能接近此代码。
有什么帮助吗?
using 1.5, i want to programmatically create an mms and insert it into inbox.
working code for inserting sms is
ContentValues val = new ContentValues();
val.put("body", "This is test message!!");
val.put("address", "1234");
val.put("date", "1234567891204");
getContentResolver().insert(Uri.parse("content://sms/inbox"), val);
this code is working, i need same thing (if possible) for inserting mms (i.e. text message with e.g. .png attachment) or may be close to this code.
any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我自己想出了一个办法。
AFAIK,您无法在对话中插入带有附件的消息(以编程方式)。不会为带有附件的消息创建新的消息线程(不知道为什么)。因此,您可以为收件人插入一条虚拟短信,然后插入带有附件的消息并删除虚拟短信。
希望它能帮助别人!
well i figured out a way myself.
AFAIK, you cannot insert message with attachments (programmatically) in conversations. A new messaging thread is not created for a message with attachments (don't know why). So you can insert a dummy sms for the recipient, then insert your message with attachments and delete the dummy sms.
Hope it will help someone!