text - How to get only sent messages from specific conversation in Android Studio? -


    contentresolver cr = getcontentresolver();     string[] projection = new string[]{"body", "ct_t", "_id", "address"};     uri uri = uri.parse("content://mms-sms/conversations/" + id);     cursor c = cr.query(uri, projection, null, null, null); 

this queries messages specific conversation , sent messages display need distinguish each party of conversation. there such thing uri this:

uri uri2 = uri.parse("content://mms-sms/conversations/" + id + "/sent/"); 

you'll need add couple of columns projection, , include selection argument in query() call.

final string[] projection = {"_id", "address", "body", "ct_t", "type", "msg_box"}; final string selection = "(type = 2 or msg_box = 2)"; final uri uri = uri.parse("content://mms-sms/conversations/" + threadid); cursor c = getcontentresolver().query(uri, projection, selection, null, null); 

an sms message have type value of 2 when has been sent. mms message have same value, in msg_box column.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -