Android BroadcastReceiver without intent filters

Viewed 5989

I saw in few android ad networks sdks that they are declaring BroadcastReceiver with no intent filters. Something like this:

<receiver android:name="com.example.SampleReceiver" />

My guess is that such receiver would capture all possible events. So I've tried doing it myself and created a SampleReceiver:

public class SampleReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        System.out.println("Event captured: " + intent.getAction());
    }
}

I've launched the app, tried to fire some events by doing various action on my phone and noticed that onReceive() wasn't called even once.

So the question is - how does such BroadcastReceiver without intent filters work? Maybe it require the intent filters to be created via code? If so, how? If not, then why isn't it receiving any events? What's going on here?

2 Answers
Related