Ilya Gazman
Ilya Gazman

Reputation: 32271

What is the `Telephony.Sms.TYPE` equivalent in `Telephony.Mms`?

I want to pull all the MMS messages and tell for each one if it was sent by the user or by the recipient?

In SMS it can be done using the Telephony.Sms.TYPE column(message from recipients will be Telephony.Sms.MESSAGE_TYPE_INBOX and the user is everything else), but how to do it in Telephony.Mms?
My current solution is to query Inbox and Outbox separately and then combine them. But it's far from ideal.

I also have been trying to use DATE_SENT, but it's not reliable.

Upvotes: 2

Views: 300

Answers (2)

Melanie Marval
Melanie Marval

Reputation: 11

The equivalent of SMS (Telephony.Sms.TYPE)

In MMS is (Telephony.Mms.MESSAGE_BOX), here the documentation: https://developer.android.com/reference/android/provider/Telephony.Mms

Where Telephony.Mms.MESSAGE_BOX_INBOX are those received and everything else is sent by you.

Upvotes: 0

rogalz
rogalz

Reputation: 80

I'm doing this in that way:

context.contentResolver.query(
        Telephony.Mms.CONTENT_URI, arrayOf(
            "_id",
            "thread_id",
            "date",
            "m_type",
            "read",
        ), null, null, null
    )

and

override val viewType: MessageType = when (type) {
    128 -> MessageType.OUTGOING
    else -> MessageType.INCOMING
}

I'm not sure it's best solution but it works. IMHO documentation is a little bit confusing...

Upvotes: 0

Related Questions