Get full conversation with Android query -
i messages 1 contact. have contact id _id
, i've :
private void displaymessages() { contentresolver cr = this.getcontentresolver(); try { cursor cursor = cr.query(uri.parse("content://mms-sms/conversations"), new string[]{"*"}, this.contid + "= _id" , null, null); //contid unique id 1 contact in our android. while (cursor.movetonext()) { system.out.println("number: " + cursor.getstring(cursor.getcolumnindexorthrow("address"))); system.out.println("body : " + cursor.getstring(cursor.getcolumnindexorthrow("body"))); } cursor.close(); } catch (exception e) { system.out.print("error"); }
i've asked like
select * content://mms-sms/conversations _id = contid
as can see, in query, ask system messages 1 contact (user id know) can display last message body. think exists others query messages 1 user ?
any ideas ???
i doubt _id
in case id of contact sending sms/mms rather thread's id. column want use query clause recipient_ids. debugging purpose try without clause , dump cursor analyze results
cursor cursor = cr.query(uri.parse("content://mms-sms/conversations"), new string[]{"*"}, null , null, null); databaseutils.dumpcursor(cursor);
Comments
Post a Comment