我正在实施此处讨论的方法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);
当我尝试通过光标获取数据时,我没有获得MMS消息的ID。我只获取短信的ID。
答案 0 :(得分: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);
答案 1 :(得分:0)
我的代码是对的。它只需要这段代码来获取消息的id
cursor.moveToFirst();
String address = cursor.getString(cursor.getColumnIndex("_id"));