Android 2.2的阅读短信收件箱的邮件收件箱、邮件、短信、Android

2023-09-04 05:48:19 作者:腼腆▓小青年§

我能读短信收件箱并显示所有消息。我有两个问题。第一个是该人字段总是NULL

这是我的查询到内容://短信/收件箱。

 光标光标= context.getContentResolver()查询(SMS_INBOX_CONTENT_URI,
           新的String [] {_id,thread_id单,地址,人,日期,身体},
                     空值,
                     空值,
                     排序);
 

该人士字段始终是NULL。有没有一种方法来检索这个短信实际的显示名称?是否有一个连接到另一个表检索显示名称?

二,当我测试了我的手机,我发现我的短信中不包括查询。为什么会这样?是否有可能解决这一问题?

在此先感谢。

解决方案

 此人场总是NULL。有没有一种方法来检索实际的显示名称


这个短信?是否有一个连接到另一个表检索显示名称?
 
Android 手机电子邮件配置方法

有关显示名称必须使用另一个查询和光标,或者你可以加入查询获取的人的名字,但有时你没有得到这个名字,因为那个人的接触不会被保存在您的联系人列表或任何其他组织或公司将发送邮件,那么你没有得到的名称,以便在那个时候可以联系表中查询来获取名称,如果找到则可以显示它,否则显示的地址为默认值。

在此你得到的地址是发件人地址为数字格式,所以你需要传递的联络查询该号码检索人的姓名

I'm able to read SMS Inbox and display all messages. I have two problems. The first one is that the person field is always NULL.

This is my query to the "content://sms/inbox".

Cursor cursor = context.getContentResolver().query(SMS_INBOX_CONTENT_URI,
           new String[] { "_id", "thread_id", "address", "person", "date", "body" },
                     null,
                     null,
                     SORT_ORDER);

The person field is always NULL. Is there a way to retrieve the actual display name for this SMS message? Is there a join to another table to retrieve display name?

Second, when I tested on my phone, I noticed that my SMS messages are not included in the query. Why is that so? Is it possible to fix this?

Thanks in advance.

解决方案

The person field is always NULL. Is there a way to retrieve the actual display name for


this SMS message? Is there a join to another table to retrieve display name?

For display name you have use another query and cursor or you can join the query to fetch the name of the person but sometime you didn't get the name because that person contact not saved in your contact list or any another organization or company will send the message then you didn't get the name so at that time can query on contact table to fetch the name if found then you can display it otherwise display the address as default.

In this you got the address that was the sender address as in number format so you need to pass this number in the contact query to retrieve the name of that person

 
精彩推荐