I'm working on a simple sms app and I'm using the code below to get the thread id when loading my threads list but I can't figure out how to get the contact id using the thread id. I'm root and using root explorer I can see in the database there is a contacts table with the following columns
thread_id | htcthread_id | contact_id
So since I have the thread id I should be able to get the contact id but I also need to make sure this works on all devices. My app is not root by the way
code to get thread id
Uri uri = Uri.parse("content://mms-sms/conversations?simple=true");
Cursor c = context.getContentResolver().query(uri, null, null, null, "date desc");
if (c.getCount() > 0) {
while (c.moveToNext()){
//thread id is c.getString(c.getColumnIndexOrThrow("_id"))
}
}
c.close