<receiver>

syntax:
<receiver android:directBootAware=["truthful" | "false"]           android:enabled=["truthful" | "false"]           android:exported=["true" | "false"]           android:icon="drawable resource"           android:label="string resource"           android:proper noun="string"           android:permission="string"           android:procedure="string" >     . . . </receiver>
independent in:
<application>
can contain:
<intent-filter>
<meta-information>
description:
Declares a broadcast receiver (a BroadcastReceiver bracket) as i of the application'due south components. Broadcast receivers enable applications to receive intents that are broadcast by the system or by other applications, even when other components of the application are not running.

At that place are ii means to make a broadcast receiver known to the system: I is declare information technology in the manifest file with this element. The other is to create the receiver dynamically in code and register it with the Context.registerReceiver() method. For more information almost how to dynamically create receivers, see the BroadcastReceiver class description.

Warning: Limit how many broadcast receivers y'all set in your app. Having likewise many circulate receivers tin can touch your app'southward performance and the battery life of users' devices. For more information near APIs you tin use instead of the BroadcastReceiver class for scheduling background work, see Groundwork Optimizations.

attributes:
android:directBootAware

Whether or not the broadcast receiver is direct-boot aware; that is, whether or not information technology can run earlier the user unlocks the device.

Note: During Straight Kicking, a broadcast receiver in your awarding can only access the data that is stored in device protected storage.

The default value is "false".

android:enabled
Whether or not the broadcast receiver can be instantiated past the system — "true" if it can be, and "false" if not. The default value is "true".

The <application> element has its own enabled attribute that applies to all application components, including broadcast receivers. The <application> and <receiver> attributes must both be "true" for the broadcast receiver to be enabled. If either is "fake", it is disabled; it cannot exist instantiated.

android:exported
Whether the circulate receiver can receive messages from non-arrangement sources exterior its application — "true" if it can, and "simulated" if not. If "simulated", the but letters the broadcast receiver can receive are those sent past the system, components of the same application, or applications with the same user ID.

If unspecified, the default value depends on whether the broadcast receiver contains intent filters. If the receiver contains at least ane intent filter, then the default value is "true". Otherwise, the default value is "false".

This attribute is not the only way to limit a circulate receiver's external exposure. You can also use a permission to limit the external entities that can send it messages (meet the permission attribute).

android:icon
An icon representing the circulate receiver. This attribute must be set every bit a reference to a drawable resource containing the prototype definition. If it is not fix, the icon specified for the application equally a whole is used instead (see the <application> element'due south icon attribute).

The broadcast receiver's icon — whether gear up hither or by the <application> chemical element — is also the default icon for all the receiver's intent filters (see the <intent-filter> element's icon aspect).

android:label
A user-readable label for the broadcast receiver. If this attribute is non set, the characterization set for the awarding as a whole is used instead (see the <application> element'south label attribute).

The broadcast receiver'due south label — whether fix hither or by the <application> element — is also the default label for all the receiver's intent filters (meet the <intent-filter> element's characterization aspect).

The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. Nevertheless, as a convenience while you're developing the application, it can also be prepare as a raw cord.

android:proper name
The name of the form that implements the broadcast receiver, a bracket of BroadcastReceiver. This should be a fully qualified class name (such as, "com.case.project.ReportReceiver"). However, as a shorthand, if the first character of the name is a period (for example, ". ReportReceiver"), it is appended to the package name specified in the <manifest> element.

Once you publish your application, you should not change this name (unless you've set android:exported="simulated").

There is no default. The name must be specified.

android:permission
The proper name of a permission that broadcasters must take to ship a message to the broadcast receiver. If this attribute is not set, the permission fix by the <application> chemical element's permission attribute applies to the broadcast receiver. If neither attribute is set, the receiver is not protected by a permission.

For more data on permissions, see the Permissions section in the introduction and a split document, Security and Permissions.

android:process
The proper name of the process in which the circulate receiver should run. Unremarkably, all components of an application run in the default process created for the awarding. It has the aforementioned proper name equally the application parcel. The <application> element'due south procedure attribute can set a unlike default for all components. Only each component can override the default with its own process attribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the awarding, is created when information technology's needed and the circulate receiver runs in that process. If the procedure proper noun begins with a lowercase grapheme, the receiver volition run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

introduced in:
API Level one