Android provides a lot of query system data Uris. Here are some common Uris for MMS and SMS and some analysis on them.
Uri:
Content: // SMS
SQL statement:
Select * from SMS where ({where}) order by date DESC
Available columns:
_ ID: thread_id: Address: Person: Date: Protocol: Read: Status: Type: reply_path_present:
Subject: Body: service_center: Locked: error_code: seen:
Uri:
Content: // MMS
SQL statement:
Select * From PDU where ({where}) order by date DESC
Available columns:
_ 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:
Uri:
Content: // MMS/threads (selection must be null)
SQL statement:
Select * From PDU group by thread_id
Available columns:
_ 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:
Uri:
Content: // MMS/{ID}/part (ID: PDU table _ id, part table mid, pending_msgs table msg_id)
SQL statement:
Select * from part where (mid = {ID}) and ({where}) order by seq
Available columns:
_ ID: Mid: seq: CT: Name: chset: CD: FN: CID: CL: ctt_s: ctt_t: _ DATA: text:
Uri:
Content: // MMS/part/{ID} (ID is the _ ID of the part table)
SQL statement:
Select * from part where (_ id = {ID}) and ({where}) order by seq
Available columns:
_ ID: Mid: seq: CT: Name: chset: CD: FN: CID: CL: ctt_s: ctt_t: _ DATA: text:
Uri:
Content: // MMS/{ID}/ADDR (ID: PDU table _ id, part table mid, pending_msgs table msg_id)
SQL statement:
Select * From ADDR where (msg_id = {ID}) and ({where })
Available columns:
_ ID: msg_id: contact_id: Address: Type: charset:
Uri:
Content: // MMS-SMS/complete-conversations (the available column must be specified for projection; otherwise, null is returned for this column)
SQL statement:
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)
Available columns:
All columns in SMS, PDU, pending_msgs can be used. If the column does not exist, null is returned.
Uri:
Content: // MMS-SMS/conversations (same as above)
SQL statement:
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)
Available columns:
Same as above
Content: // MMS-SMS/conversations/{threadid} (threadid is the thread_id of the SMS table, _ ID of the PDU table, msg_id of the pending_msgs table, and mid of the part table)
SQL statement:
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
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)
Same as above
The following are the various Uris provided by Android for MMS and SMS.
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
// 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
// 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-Addresses
Content: // 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 pending mm which Id equals '1 ′.
//
Content: // MMS-SMS/pending
// Use this pattern to get a list of undelivered messages.
Content: // MMS-SMS/undelivered
// Use this pattern to see what delivery status reports (
// Both MMS and SMS) have not been delivered to the user.
Content: // MMS-SMS/notifications
Content: // MMS-SMS/Draft
Content: // MMS-SMS/locked
Content: // MMS-SMS/locked /#