views:

710

answers:

1

In my app I need to query both the SMS and the MMS log to get the history of all incoming and outgoing messages. This code has worked wonderfully for SMS:

Cursor c = cr.query(Uri.parse("content://sms"), null, null, null, null);

But when I try the following I get completely different results:

Cursor c = cr.query(Uri.parse("content://mms"), null, null, null, null);

The SMS query returns data that includes the message address (phone number), contact name, message subject, message body, etc... The same query for MMS returns a bunch of nulls or numeric value fields that I can't make any sense of. I really need a list of all MMS messages currently on the phone with the phone number or contact ID associated with it, and if the message was an incoming or outgoing message. In the SMS query results I can get the phone number from the address field, and the incoming/outgoing type from the type field but neither of these exist when I query for MMS.

Is there a different content Uri that I need to query for this sort of MMS data? Any help would be greatly appreciated.

Edit: Just to clarify, I'm completely aware that this is an unsupported content provider. However since there is no supported way of doing this I'm fully willing to test and support this on a per phone/per OS version basis. Just to keep the discussion on track lets say this question is specific to Android 1.6 on an HTC Dream (G1) or HTC Magic (MyTouch). How would you accomplish this task on that specific phone and OS version? Or if it's not possible on those, but it is possible on Android 2.0 on a Motorola Droid, then I would find that information very helpful as well. But regardless, lets stick to the discussion of how to accomplish this task in a supported or unsupported manner and not let it devolve into a discussion of how we should all stay away from things that aren't supported by the API, which is something I find the Android discussion groups to be riddled with and which I feel provides little to no help whatsoever. If I'm using an unsupported method, that's fine, show me the supported method of accomplishing that task. If there is no supported method, then why does the API support allowing me to request permission to read SMS via android.permission.READ_SMS?

A: 

I think,you can find your answer here : http://efreedom.com/Question/1-2591530/ContentObserver-Content-Sms-16

Sandy