Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转到sms pro和android.provider.Telephony.sms_接收接收器_Android - Fatal编程技术网

转到sms pro和android.provider.Telephony.sms_接收接收器

转到sms pro和android.provider.Telephony.sms_接收接收器,android,Android,我用广播接收器读短信,比如: if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) { ... } 但是现在我安装了go-sms-pro,我的接收器再也不会被触发了。为什么?即使我正在使用go sms pro,我怎么还能启动我的接收器?在清单中,您在清单中声明您的意图。加: <intent-filter android:priority="1000"> GoSMSPro的优先级高于您

我用广播接收器读短信,比如:

if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) {
...
}

但是现在我安装了
go-sms-pro
,我的接收器再也不会被触发了。为什么?即使我正在使用go sms pro,我怎么还能启动我的接收器?

在清单中,您在清单中声明您的意图。加:

<intent-filter android:priority="1000">


GoSMSPro的优先级高于您的侦听器,很可能go sms pro在其清单中为SmsReceiver设置了以下行:

<receiver android:name=".smspopup.SmsReceiver"     android:permission="android.permission.BROADCAST_SMS">
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.GSM_SMS_RECEIVED" />
            <category android:name="android.intent.category.DEFAULT" />
        </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="com.android.mms.transaction.MESSAGE_SENT" />
        </intent-filter>
    </receiver>

即使您的接收器的优先级设置为2147483647,所有这些意向过滤器也会使其优先级高于接收器。您可以通过以下方式查看所有应用程序的所有接收器列表:

List<ResolveInfo> receivers = getPackageManager().queryBroadcastReceivers(new Intent("android.provider.Telephony.SMS_RECEIVED"), 0);
List receivers=getPackageManager().querybroadcasreceivers(新意图(“android.provider.Telephony.SMS_RECEIVED”),0;
列表中的第一个接收者比其他接收者先接收sms