What is the correct CONTENT_URI for the SMS thread table?
Asked Answered
I

1

6

I'm attempting to query the SMS thread table, but I don't seem to use the correct URI.

Querying the URI "content://sms/conversations" gives me the columns:

[thread_id, msg_count, snippet]

Querying the URI "content://mms-sms/conversations" gives me the columns:

[body, person, sub, subject, retr_st, type, date, ct_cls, sub_cs, _id, read, ct_l, tr_id, st, msg_box, thread_id, reply_path_present, m_cls, read_status, ct_t, status, retr_txt_cs, d_rpt, error_code, m_id, m_type, v, exp, pri, service_center, address, rr, rpt_a, resp_txt, locked, resp_st, m_size]

I'm looking for the URI that gives the values from the Threads table in android/provider/Telephony.java - data, recipient_ids, message_count, read, etc...

Thanks

Intellectual answered 22/8, 2011 at 14:29 Comment(2)
I think this thread can help to answer this question: #7036470Aeromancy
See also #3012787Autopsy
A
-1

try this

    Uri uri = Uri.parse("content://sms/");

you can get what you want like this

    Uri uri = Uri.parse("content://sms/");

    // List required columns
    String[] reqCols = new String[] { "_id", "body" };

    // Get Content Resolver object, which will deal with Content Provider
    ContentResolver cr = context.getContentResolver();

    // Fetch Sent SMS Message from Built-in Content Provider
    Cursor cursor = cr.query(uri, reqCols, "address = '" + number + "'", null, null);

    // Attached Cursor with adapter and display in listview
    adapter = new SimpleCursorAdapter(context, R.layout.single_conversation_view, cursor, new String[] {"body" }, new int[] {  R.id.tv_single_conversation_message }, 1);

    lv_single_conversation.setAdapter(adapter);

hope it will help you

Atlee answered 17/4, 2015 at 9:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.