I want to read MMS data I have seen the part table in the mmssms.db where the mms entries are stored; I am using a cursor and I want to know the appropriate
I've just been struggling with this; however, I finally got it to work and I thought this thread might benefit from my experience.
I could query on content://mms-sms/conversations/ (Telephony.Threads.CONTENT_URI) and get addresses and parts as helpfully described in the thread, but I found that this URI would not retrieve threads that only had MMS messages in them - for example, threads with more than two correspondents.
After doing some digging in the AOSP MMS app source, I found that it was using a variant on Telephony.Threads.CONTENT_URI to generate its conversation list - it was adding the parameter "simple" with the value "true". when I added this parameter, I found that the provider would query a completely different table, which did indeed have all the SMS and MMS threads in it.
This table has a completely different schema from the regular Telephony.Threads.CONTENT_URI one (???); this is the projection that the AOSP app is using --
public static final String[] ALL_THREADS_PROJECTION = {
Threads._ID, Threads.DATE, Threads.MESSAGE_COUNT, Threads.RECIPIENT_IDS,
Threads.SNIPPET, Threads.SNIPPET_CHARSET, Threads.READ, Threads.ERROR,
Threads.HAS_ATTACHMENT
};
The _ID here is the ID of the thread - so an ID into Telephony.Sms.CONTENT_URI or Telephony.Mms.CONTENT_URI.
After I discovered this bizarre detail, things started to work a lot better! Note however that the DATE column in the "simple=true" variant is not reliable, i had to use the date from the most recent Sms or Mms message instead.
Another thing I should probably mention is that in order to get a proper list of messages for a particular thread, I had to query on both the Mms and Sms providers, then combine the results into one list, then sort them by date.
I verified behaviour on Android 5.x and 7.x.
I hope this helps a bit more.