在Android应用中未检测到传入的MMS
我正在研究一个应该检测到传入的SMS和MMS并进行一些后续操作的Android应用程序。我能够毫无问题地实现SMS部分,但是在MMS方面,该应用程序没有检测到它们。
我在清单文件中有以下几行:
<receiver
android:name="com.library.MmsReceiver"
android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"
android:priority="1" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
另外,我要求MMS的以下权限:
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
接收器类以以下方式声明:
class MmsReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Log.d(MmsReceiver::class.java.simpleName, "onReceive: MMS RECEIVED")
}
}
当我收到MMS消息时,我希望在控制台中看到上述日志,但是什么都没有显示。
我查看了stackoverflow上的其他帖子,例如在Android上检测MMS消息” https://stackoverflow.com/questions/14452808/sending-and-receiviv-sms-sms-and-mms-in-indroid-pre-kit-kit-kat-kat-android-4-4"> (pre kit kat android 4.4)或如何在Android上读取传入的MMS和SMS消息,但没有任何帮助。
我是否缺少任何配置步骤?任何帮助都将不胜感激。
I am working on an Android app that is supposed to detect incoming SMSs and MMSs and do some follow-up operations. I was able to implement the SMS part without any problem but when it comes to MMS, the app is not detecting them.
I have the following lines in the Manifest file:
<receiver
android:name="com.library.MmsReceiver"
android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"
android:priority="1" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
Also, I am asking for the following permissions for MMS:
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
The receiver class is declared in the following way:
class MmsReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Log.d(MmsReceiver::class.java.simpleName, "onReceive: MMS RECEIVED")
}
}
When I receive an MMS message, I expect to see the above log in the console, but nothing is shown.
I looked over other posts on StackOverflow like Detecting MMS messages on Android, Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4) or How to read incoming MMS and SMS messages on Android but nothing helped.
Am I missing any configuration steps? Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档说:
WAP_PUSH_DELIVER_ACTION
广播操作:设备已收到新的 WAP PUSH 消息。 此意图只会发送到默认短信应用。
尝试以下操作:
WAP_PUSH_RECEIVED_ACTION
广播操作:设备已收到新的 WAP PUSH 消息。 此意图将作为通知传递给所有注册的接收者。
The docs say:
WAP_PUSH_DELIVER_ACTION
Broadcast Action: A new WAP PUSH message has been received by the device. This intent will only be delivered to the default sms app.
Try this:
WAP_PUSH_RECEIVED_ACTION
Broadcast Action: A new WAP PUSH message has been received by the device. This intent will be delivered to all registered receivers as a notification.