Android MMS,SMS之常用Uri
Android提供了很多查询系统数据的Uri,这里是一些关于MMS,SMS常用的Uri以及对其的一些分析
Uri:
content://sms
sql语句:
SELECT * FROM sms WHERE ({where}) ORDER BY date DESC
可用列:
_id:thread_id:address:person:date:protocol:read:status:type:reply_path_present:
subject:body:service_center:locked:error_code:seen:
subject:body:service_center:locked:error_code:seen:
Uri:
content://mms
sql语句:
SELECT * FROM pdu WHERE ({where}) ORDER BY date DESC
可用列:
_id:thread_id:date:msg_box:read:m_id:sub:sub_cs:ct_t:ct_l:exp:m_cls:m_type:
v:m_size:pri:rr:rpt_a:resp_st:st:tr_id:retr_st:retr_txt:retr_txt_cs:read_status:ct_cls:
resp_txt:d_tm:d_rpt:locked:seen:
v:m_size:pri:rr:rpt_a:resp_st:st:tr_id:retr_st:retr_txt:retr_txt_cs:read_status:ct_cls:
resp_txt:d_tm:d_rpt:locked:seen:
Uri:
content://mms/threads (selection须为null)
sql语句:
SELECT * FROM pdu group by thread_id
可用列:
_id:thread_id:date:msg_box:read:m_id:sub:sub_cs:ct_t:ct_l:exp:m_cls:m_type:
v:m_size:pri:rr:rpt_a:resp_st:st:tr_id:retr_st:retr_txt:retr_txt_cs:read_status:ct_cls:
resp_txt:d_tm:d_rpt:locked:seen:
v:m_size:pri:rr:rpt_a:resp_st:st:tr_id:retr_st:retr_txt:retr_txt_cs:read_status:ct_cls:
resp_txt:d_tm:d_rpt:locked:seen:
Uri:
content://mms/{id}/part (id为pdu表_id,part表mid,pending_msgs表msg_id)
sql语句:
SELECT * FROM part WHERE (mid={id}) AND ({where}) ORDER BY seq
可用列:
_id:mid:seq:ct:name:chset:cd:fn:cid:cl:ctt_s:ctt_t:_data:text:
Uri:
content://mms/part/{id} (id为part表的_id)
sql语句:
SELECT * FROM part WHERE (_id={id}) AND ({where}) ORDER BY seq
可用列:
_id:mid:seq:ct:name:chset:cd:fn:cid:cl:ctt_s:ctt_t:_data:text:
Uri:
content://mms/{id}/addr (id为pdu表_id,part表mid,pending_msgs表msg_id)
sql语句:
SELECT * FROM addr WHERE (msg_id={id}) AND ({where})
可用列:
_id:msg_id:contact_id:address:type:charset:
Uri:
content://mms-sms/complete-conversations (projection必须指定可用列,否则该列返回null)
sql语句:
SELECT {projection} FROM (SELECT DISTINCT date * 1 AS normalized_date, {projection} FROM sms WHERE ({where}) AND (type != 3)) UNION SELECT DISTINCT date * 1000 AS normalized_date, {projection} FROM pdu LEFT JOIN pending_msgs ON pdu._id = pending_msgs.msg_id WHERE ({where}) AND msg_box != 3 AND (msg_box != 3 AND (m_type = 128 OR m_type = 132 OR m_type = 130))) ORDER BY normalized_date ASC)
可用列:
一切sms,pdu,pending_msgs中的列均可用,不存在则返回null
Uri:
content://mms-sms/conversations (同上)
sql语句:
SELECT {projection} FROM (SELECT thread_id AS tid, date * 1000 AS normalized_date, NULL AS body, NULL AS person, sub, NULL AS subject, retr_st, NULL AS type, date, ct_cls, sub_cs, _id, read, ct_l, tr_id, st, msg_box, thread_id, NULL AS reply_path_present, m_cls, read_status, ct_t, NULL AS status, retr_txt_cs, d_rpt, NULL AS error_code, m_id, m_type, v, exp, pri, NULL AS service_center, NULL AS address, rr, rpt_a, resp_txt, locked, resp_st, m_size FROM pdu WHERE ({where}) AND (msg_box != 3 AND (m_type = 128 OR m_type = 132 OR m_type = 130))) GROUP BY thread_id HAVING date = MAX(date) UNION SELECT thread_id AS tid, date * 1 AS normalized_date, body, person, NULL AS sub, subject, NULL AS retr_st, type, date, NULL AS ct_cls, NULL AS sub_cs, _id, read, NULL AS ct_l, NULL AS tr_id, NULL AS st, NULL AS msg_box, thread_id, reply_path_present, NULL AS m_cls, NULL AS read_status, NULL AS ct_t, status, NULL AS retr_txt_cs, NULL AS d_rpt, error_code, NULL AS m_id, NULL AS m_type, NULL AS v, NULL AS exp, NULL AS pri, service_center, address, NULL AS rr, NULL AS rpt_a, NULL AS resp_txt, locked, NULL AS resp_st, NULL AS m_size FROM sms WHERE ({where}) AND (type != 3)) GROUP BY thread_id HAVING date = MAX(date)) GROUP BY tid HAVING normalized_date = MAX(normalized_date)
可用列:
同上
content://mms-sms/conversations/{threadID} (threadID为sms表的thread_id,pdu表的_id,pending_msgs表的msg_id,part表的mid)
sql语句:
SELECT {projection} FROM (SELECT DISTINCT date * 1 AS normalized_date, {projection} FROM sms WHERE ({where}) AND thread_id = {thread_id} AND (type != 3)) UNION SELECT DISTINCT date * 1000 AS normalized_date, pdu._id, NULL AS body FROM pdu LEFT JOIN pending_msgs ON pdu._id = pending_msgs.msg_id WHERE ({where}) AND thread_id = {thread_id} AND msg_box != 3 AND (msg_box != 3 AND (m_type = 128 OR m_type = 132 OR m_type = 130))) ORDER BY normalized_date ASC)
同上
以下是Android提供的关于MMS,SMS的各种Uri
content://sms
content://sms/#
content://sms/inbox
content://sms/inbox/#
content://sms/sent
content://sms/sent/#
content://sms/draft
content://sms/draft/#
content://sms/outbox
content://sms/outbox/#
content://sms/undelivered
content://sms/failed
content://sms/failed/#
content://sms/queued
content://sms/conversations
content://sms/conversations/*
content://sms/raw
content://sms/attachments
content://sms/attachments/#
content://sms/threadID
content://sms/threadID/*
content://sms/status/#
content://sms/sr_pending
content://sms/icc
content://sms/icc/#
content://sms/sim
content://sms/sim/#
content://mms
content://mms/#
content://mms/inbox
content://mms/inbox/#
content://mms/sent
content://mms/sent/#
content://mms/drafts
content://mms/drafts/#
content://mms/outbox
content://mms/outbox/#
content://mms/part
content://mms/#/part
content://mms/part/#
content://mms/#/addr
content://mms/rate
content://mms/report-status/#
content://mms/report-request/#
content://mms/drm
content://mms/drm/#
content://mms/threads
content://mms/scrapSpace
content://mms-sms/conversations
content://mms-sms/complete-conversations
content://mms-sms/conversations/#/recipients
content://mms-sms/conversations/#/subject
content://mms-sms/messages/byphone/*
content://mms-sms/search
content://mms-sms/draft
content://mms-sms/locked
content://mms-sms/locked/#
content://sms/#
content://sms/inbox
content://sms/inbox/#
content://sms/sent
content://sms/sent/#
content://sms/draft
content://sms/draft/#
content://sms/outbox
content://sms/outbox/#
content://sms/undelivered
content://sms/failed
content://sms/failed/#
content://sms/queued
content://sms/conversations
content://sms/conversations/*
content://sms/raw
content://sms/attachments
content://sms/attachments/#
content://sms/threadID
content://sms/threadID/*
content://sms/status/#
content://sms/sr_pending
content://sms/icc
content://sms/icc/#
content://sms/sim
content://sms/sim/#
content://mms
content://mms/#
content://mms/inbox
content://mms/inbox/#
content://mms/sent
content://mms/sent/#
content://mms/drafts
content://mms/drafts/#
content://mms/outbox
content://mms/outbox/#
content://mms/part
content://mms/#/part
content://mms/part/#
content://mms/#/addr
content://mms/rate
content://mms/report-status/#
content://mms/report-request/#
content://mms/drm
content://mms/drm/#
content://mms/threads
content://mms/scrapSpace
content://mms-sms/conversations
content://mms-sms/complete-conversations
// In these patterns, “#” is the thread ID.
content://mms-sms/conversations/#content://mms-sms/conversations/#/recipients
content://mms-sms/conversations/#/subject
// URI for deleting obsolete threads.
content://mms-sms/conversations/obsolete”, URI_OBSOLETE_THREADS);content://mms-sms/messages/byphone/*
// In this pattern, two query parameter names are expected:
// “subject” and “recipient.” Multiple “recipient” parameters
// may be present.
content://mms-sms/threadID// “subject” and “recipient.” Multiple “recipient” parameters
// may be present.
// Use this pattern to query the canonical address by given ID.
content://mms-sms/canonical-address/#// Use this pattern to query all canonical addresses.
content://mms-sms/canonical-addressescontent://mms-sms/search
// In this pattern, two query parameters may be supplied:
// “protocol” and “message.” For example:
// content://mms-sms/pending?
// -> Return all pending messages;
// content://mms-sms/pending?protocol=sms
// -> Only return pending SMs;
// content://mms-sms/pending?protocol=mms&message=1
// -> Return the the pending MM which ID equals ’1′.
//
content://mms-sms/pending// “protocol” and “message.” For example:
// content://mms-sms/pending?
// -> Return all pending messages;
// content://mms-sms/pending?protocol=sms
// -> Only return pending SMs;
// content://mms-sms/pending?protocol=mms&message=1
// -> Return the the pending MM which ID equals ’1′.
//
// Use this pattern to get a list of undelivered messages.
content://mms-sms/undelivered// Use this pattern to see what delivery status reports (for
// both MMS and SMS) have not been delivered to the user.
content://mms-sms/notifications// both MMS and SMS) have not been delivered to the user.
content://mms-sms/draft
content://mms-sms/locked
content://mms-sms/locked/#