0

我正在实现这里讨论的方法How to Read MMS Data in Android。这是代码片段:

ContentResolver contentResolver = getContentResolver();
final String[] projection = new String[]{"*"};
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor query = contentResolver.query(uri, projection, null, null, null);

当我尝试通过光标获取数据时,我没有得到彩信的 ID。我只得到 SMS 消息的 ID。

4

2 回答 2

0

将您的代码更改为:

ContentResolver contentResolver = getContentResolver();

final String[] projection = new String[]{"*"};

Uri MMSSMS_FULL_CONVERSATION_URI = Uri.parse("content://mms-sms/conversations");  

Uri uri  = MMSSMS_FULL_CONVERSATION_URI.buildUpon().  
     appendQueryParameter("simple", "true").build(); 

Cursor query = contentResolver.query(uri, projection, null, null, null);
于 2012-06-30T08:08:52.233 回答
0

我的代码是正确的。它只需要此代码即可获取消息的 id

cursor.moveToFirst();
String address = cursor.getString(cursor.getColumnIndex("_id"));
于 2012-06-30T09:45:14.610 回答