Search code examples
androidbroadcastreceiver

how can find out how many BroadcastReceiver registered on the phone


I'm on sms application that should find out how many sms receivers registers in user phone. I googled and find this link but it seems that you can just get your package receivers with:

  List<ResolveInfo> myList = getPackageManager().queryBroadcastReceivers(i,0);

Solution

  • The Intent you pass in the queryBroadcastReceivers() call needs to match up with the <intent-filter> of the Receivers you're looking for. In your case, you simply need to create the Intent with the SMS_RECEIVED action.

    Intent i = new Intent("android.provider.Telephony.SMS_RECEIVED");