public static final Uri MMSSMS_FULL_CONVERSATION_URI = Uri.parse("content://mms-sms/conversations");
public static final Uri CONVERSATION_URI = MMSSMS_FULL_CONVERSATION_URI.buildUpon().
appendQueryParameter("simple", "true").build();
通过指定simple=true,则可以获取出一个大概的会话数据,包含以下列:
private static final int ID = 0;
private static final int DATE = 1;
private static final int MESSAGE_COUNT = 2;
private static final int RECIPIENT_IDS = 3;
private static final int SNIPPET = 4;
private static final int SNIPPET_CS = 5;
private static final int READ = 6;
private static final int TYPE = 7;
private static final int ERROR = 8;
private static final int HAS_ATTACHMENT = 9;
_id is the ID of the message. Captain obvious to the rescue? Not really. This ID can be used to retrieve detailed information using either content://sms or content://mms.
body The content of the last SMS on this conversation. If it's an MMS, even if it has a text part, this will be null.
Note: if you query content://mms-sms/conversations it will return a list of different conversations whose _id is the last SMS or MMS in each conversation. If you query content://mms-sms/conversations/xxx it will return each SMS and/or MMS on the conversation whose ID is xxx.
long id = cursor.getLong(ID);
long date = cursor.getLong(DATE);
long msgCount = cursor.getLong(MESSAGE_COUNT);
String recipIDs = cursor.getString(RECIPIENT_IDS);
String snippet = cursor.getString(SNIPPET);
long snippetCS = cursor.getLong(SNIPPET_CS);
long read = cursor.getLong(READ);
long type = cursor.getLong(TYPE);
long error = cursor.getLong(ERROR);
long hasAttach = cursor.getLong(HAS_ATTACHMENT);