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

Viewed 48

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.

1 Answers

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...

Related