Differentiate MMS and SMS via MMS/SMS listeners in Android
Asked Answered
P

1

6

Is there any ways to differentiate MMS and SMS messages by using a MMS/SMS listener before they hit the inbox?

Photocompose answered 19/7, 2011 at 1:35 Comment(0)
I
5

The first indicator of an MMS message is a WAP-push with the MIME-type "application/vnd.wap.mms-message", so you could register a receiver for "android.provider.Telephony.WAP_PUSH_RECEIVED":

    <receiver android:name=".SomeReceiverName"
        android:permission="android.permission.BROADCAST_WAP_PUSH">
        <intent-filter>
            <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
            <data android:mimeType="application/vnd.wap.mms-message" />
        </intent-filter>
    </receiver>

To discover whether or not its a received MMS you're going to have to crack open the PDU:s and extract the X-Mms-Message-Type, which should be m-notification-ind (as per WAP 209). You can also pick out the X-Mms-Transaction-ID, which one thinks should be stored in the Telephony.Mms.TRANSACTION_ID column in the message provider if you want to link them up later.

Iodous answered 1/11, 2011 at 11:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.