Is there any ways to differentiate MMS and SMS messages by using a MMS/SMS listener before they hit the inbox?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.