I was just wondering how I would get a list of messages on an Android device where I would have access to the information held by each message (particularly the time it was received, whether it was read, unread, or sent).
I found this answer, but it only seems to get the body of the messages and I would like to have more info than that.
Using new Telephony content provider to read SMS
I thought of making my own sms-like class that would contain the appropriate information I need and then somehow individually pulling that info and storing it, but I would imagine the Android api has some sort of sms class that I am somehow overlooking.
If someone could explain what is happening in the below code it might answer my question. I suspect changing the new String[] { Telephony.Sms.Inbox.Body }
parameter might allow me to get the info I need, but I'm just not sure. Any help?
Cursor c = cr.query(Telephony.Sms.Inbox.CONTENT_URI, // Official CONTENT_URI from docs
new String[] { Telephony.Sms.Inbox.BODY }, // Select body text
null,
null,
Telephony.Sms.Inbox.DEFAULT_SORT_ORDER);