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.
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