写短信的问题! [英] write sms problems!

查看:113
本文介绍了写短信的问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我的应用我试着写一个消息,短信收件箱像这样 ContentValues​​ CV =新ContentValues​​();结果
             cv.put(thread_id单,111);结果,
             cv.put(地址,100000);
             cv.put(协议,0);
             cv.put(身体,serverData);
             cv.put(读,0);
             context.getContentResolver()插入(Uri.parse(内容://短信/收件箱),CV);

但随后的消息收件箱是空的,将不记录消息收件箱,如果我使用其他仿真器发送消息给这一个,所有的消息将显示包括我由code写的。任何帮助吗?谢谢!

everyone,in my app i try to write a message to sms inbox like this way ContentValues cv = new ContentValues();
cv.put("thread_id", "111");
cv.put("address", "100000"); cv.put("protocol", "0"); cv.put("body", serverData); cv.put("read", "0"); context.getContentResolver().insert(Uri.parse("content://sms/inbox"), cv);
but then the message inbox is empty it will no records in message inbox,if i use the other emulator send a message to this one,all the message will appear include that i write by that code. any help? thanks!

推荐答案

我知道这是非常老了,但我一直在寻找别的东西,当我遇到这来了。

I know this is extremely old, but I was looking for something else when I came across this.

尝试使用

content://sms/sent

而不是

content://sms/inbox

这就是我在我的应用程序使用,并能正常工作。另外,我只用

That's what I use in my app, and it works fine. Also, I only use

cv.put("address", ...);
cv.put("body", ...);

但它应该更像:

cv.put("address", phoneNumber);
cv.put("body", smsText)

在哪里地址是谁送短信的人的电话号码,和身体是包含在短信中的文本。

Where "address" is phone number of the person who sent the SMS, and "body" is the text contained within the SMS.

您可能能够使用那些其他的,但它可能没有必要。尤其

You might be able to use those other ones, but it's probably not necessary. Especially

cv.put("read", "0"); 

我假定行设置为未读,但它会在默认情况下未读。

I assume that line sets it as unread, but it will be unread by default.

我希望这有助于有人在那里。

I hope this helps someone out there.

这篇关于写短信的问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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