开发者

Differentiate MMS and SMS via MMS/SMS listeners in Android

Is there any ways to开发者_运维知识库 differentiate MMS and SMS messages by using a MMS/SMS listener before they hit the inbox?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜