无法接收android.provider.Telephony.WAP_PUSH_RECEIVED

无法接收android.provider.Telephony.WAP_PUSH_RECEIVED,第1张

概述我想接收WAP推送消息.我的代码如下:publicclassPushMsgReceiverextendsBroadcastReceiver{publicfinalstaticStringTAG="PushReceiver";privatestaticfinalStringSMS_RECEIVED="android.provider.Telephony.SMS_RECEIVED";privatestaticfinal

我想接收WAP推送消息.我的代码如下:

public class PushMsgReceiver extends broadcastReceiver {public final static String TAG = "Push Receiver";private static final String SMS_RECEIVED = "androID.provIDer.Telephony.SMS_RECEIVED";private static final String PUSH_RECEIVED = "androID.provIDer.Telephony.WAP_PUSH_RECEIVED";@OverrIDepublic voID onReceive(Context context, Intent intent) {    // Todo auto-generated method stub    Log.i(TAG, "Intent recIEved: " + intent.getAction());     if (intent.getAction().equals(SMS_RECEIVED)) {        //toast to show result        Log.i(TAG, "SMS: " + intent.getAction());        Toast.makeText(context, "SMS_RECEIVED", Toast.LENGTH_LONG).show();    }    if (intent.getAction().equals(PUSH_RECEIVED)) {         //toast to show result        Log.i(TAG, "PUSH: " + intent.getAction());        Toast.makeText(context, "PUSH MSG", Toast.LENGTH_LONG).show();    }}

}

清单如下:

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"      package="com.test.pushmsg"      androID:versionCode="1"      androID:versionname="1.0">    <application androID:icon="@drawable/icon" androID:label="@string/app_name">        <activity androID:name=".main"                  androID:label="@string/app_name">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>    <receiver androID:enabled="true" androID:name=".PushMsgReceiver">     <intent-filter>      <action androID:name="androID.provIDer.Telephony.WAP_PUSH_RECEIVED" />      <action androID:name="androID.provIDer.Telephony.SMS_RECEIVED" />     </intent-filter>    </receiver></application><uses-permission androID:name="androID.permission.RECEIVE_WAP_PUSH"></uses-permission><uses-permission androID:name="androID.permission.RECEIVE_SMS"></uses-permission></manifest>

它可以接收SMS_RECEIVED,但不能接收WAP_PUSH_RECEIVED.那么谁知道为什么呢?我尝试使用registerReceiver(),但它也不起作用.

解决方法:

您需要更改接收器并添加数据哑剧部分.

<receiver androID:name=".IncomingMMS" androID:enabled="true">            <intent-filter>                <action androID:name="androID.provIDer.Telephony.SMS_RECEIVED" />            </intent-filter>            <intent-filter>                <action androID:name="androID.provIDer.Telephony.WAP_PUSH_RECEIVED" />                <data androID:mimeType="application/vnd.wap.mms-message" />            </intent-filter>            <intent-filter>                <action androID:name="net.everythingandroID.smspopup.MESSAGE_RECEIVED" />            </intent-filter>            <intent-filter>                <action androID:name="com.androID.mms.transaction.MESSAGE_SENT" />            </intent-filter>        </receiver>
总结

以上是内存溢出为你收集整理的无法接收android.provider.Telephony.WAP_PUSH_RECEIVED全部内容,希望文章能够帮你解决无法接收android.provider.Telephony.WAP_PUSH_RECEIVED所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1083349.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存