Distinguish MMS and SMS through MMS / SMS listeners in Android

Is there a way to distinguish between MMS and SMS messages using the MMS / SMS listener before they get to the inbox ?

+6
source share
1 answer

The first indicator of an MMS message is WAP push with the MIME type "application / vnd.wap.mms-message", so you can register the 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 find out if your received MMS you need to hack the PDU: s and extract the X-Mms-Message-Type , which should be m-notification-ind (according to WAP 209 ). You can also select the transaction identifier X-Mms-Transaction-ID, which is thought to be stored in the Telephony.Mms.TRANSACTION_ID column in the message provider if you want to link them later.

+4
source

Source: https://habr.com/ru/post/893029/


All Articles