Android 中通过 MMS/SMS 监听器区分 MMS 和 SMS

发布于 2024-11-24 10:21:18 字数 63 浏览 4 评论 0原文

在彩信和短信到达收件箱之前,是否可以通过使用彩信/短信侦听器来区分彩信和短信?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那些过往 2024-12-01 10:21:18

MMS 消息的第一个指示符是 MIME 类型“application/vnd.wap.mms-message”的 WAP 推送,因此您可以为“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>

:这不是收到的彩信,您必须破解 PDU:s 并提取 X-Mms-Message-Type,它应该是m-notification-ind(根据WAP 209)。您还可以选择 X-Mms-Transaction-ID,如果您想稍后将它们链接起来,您认为应该将其存储在消息提供程序的 Telephony.Mms.TRANSACTION_ID 列中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文