I\'ve come across something like this in the AndroidManifest.xml:
The above
You need to register your receiver specifying the intents you want to receive and if you want to receive all the intents then mention it.
Intent and Intent Filter are clearly mentioned in the API how they function. All intents concept are not supported in the public API.
Note: You can still use this type of receiver within your app by sending broadcast within your app.
An Intent filter is needed in case of implicit intents, and if an intent filter is not specified, it must be invoked explicitly. So to invoke this receiver you would need to invoke:
Intent intent = new Intent(getApplicationContext(), com.testco.test.TestReceiver.class);
sendBroadcast(intent);`
From the documentation:
android:exported: Whether or not the broadcast receiver can receive messages from sources outside its application — "true" if it can, and "false" if not. If "false", the only messages the broadcast receiver can receive are those sent by components of the same application or applications with the same user ID.
The default value depends on whether the broadcast receiver contains intent filters. The absence of any filters means that it can be invoked only by Intent objects that specify its exact class name. This implies that the receiver is intended only for application-internal use (since others would not normally know the class name). So in this case, the default value is "false". On the other hand, the presence of at least one filter implies that the broadcast receiver is intended to receive intents broadcast by the system or other applications, so the default value is "true".
So the receiver will only catch Intents broadcast by your application.
<receiver android:name="com.testco.test.TestReceiver"/>
tag will say to android os that i am reciver that's it. it wont say for what event it's intended to listen. Your intent filter will define, for which event you are listning for. for example,
<receiver android:name="com.testco.test.TestReceiver"/>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
this code says to android os that, i am receiver and i am listing to boot event. So when user will restart his phone, this brodcast receiver will be called.