我正在处理一个简单的短信应用程序,我使用下面的代码来获取线程ID加载我的线程列表时,但我无法弄清楚如何获得联系人ID使用线程ID。我的根和用root探险家我可以在数据库中看到有一个接触表具有以下的列Android从线程ID获取联系人ID
thread_id | htcthread_id | contact_id
所以,因为我有线程ID,我应该能够获得接触ID,但我还需要确保它适用于所有设备。我的应用程序不是由路根
代码来获取线程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
是否成功? – Hamidreza