Android - SMS - intent-filters priority listing

2019-08-26 17:57发布

问题:

I was wondering if it is possible to find a list that includes all the receivers associated to a certain action.

For example I have the following receiver that executes everytime that an SMS is received:

<receiver android:name=".SmsReceiver" android:enabled="true">
    <intent-filter android:priority="101">
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>

So with the priority="101" it´s executed even before than the default message service in Android.

I would like to find all the intent-filter associated to a certail action, in this case "android.provider.Telephony.SMS_RECEIVED"

I tried to get into /data/data/com.android.provider.telephony/databases but no info is stored in ther.

It would be great if anybody could tell me where can I find that info, and even if it is possible.

Regards,

Pablo

回答1:

Use PackageManager and queryBroadcastReceivers() to find out all of the BroadcastReceivers that will respond to a given Intent. In your case, you would create an SMS_RECEIVED Intent.