Querying the "content://sms/conversations"
URI (Telephony.Sms.Conversations.CONTENT_URI
) will return a summary of each conversation, with the "snippet"
column (Telephony.Sms.Conversations.SNIPPET
) being the last message in each.
This query will also return with a "msg_count"
column (Telephony.Sms.Conversations.MESSAGE_COUNT
) - which is pretty self-explanatory - and a "thread_id"
column (Telephony.Sms.Conversations.THREAD_ID
), which can be used to retrieve a complete conversation, by querying with that ID appended to the conversations URI. For example:
String threadId = ...
Uri convoUri = Telephony.Sms.Conversations.CONTENT_URI
.buildUpon().appendPath(threadId).build();
Do note that these queries will return only SMS messages. If you want MMS as well, Telephony.Mms
and Telephony.MmsSms
have similar URIs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…