Android Guides | Samples

Android.Content.BroadcastReceiverAttribute Class

Generates a /manifest/application/receiver element within AndroidManifest.xml.

See Also: BroadcastReceiverAttribute


[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public class BroadcastReceiverAttribute : Attribute

See Also


The //receiver element is used to declare a receiver, which are used to enable applications to reveive intents that are broadcast by the system or by otehr applications, even when other components of the application are not running. The BroadcastReceiverAttribute custom attribute is used by monodroid.exe when generating AndroidManifest.xml to to declaratively generate //receiver elements.

The type this attribute is placed on must be a (possibly indirect) subclass of BroadcastReceiver.

The following type declaration

C# Example

[BroadcastReceiver (Name="mono.samples.HelloReceiver", 
        Label="Receiver Label")]
class MyReceiver : BroadcastReceiver {

results in the following XML fragment:

XML Example

            android:label="Receiver Label" 
            android:name="mono.samples.HelloReceiver" />

In addition, types using the BroadcastReceiverAttribute custom attribute can also use the IntentFilterAttribute and MetaDataAttribute custom attributes to declaratively generate the nested //receiver/intent-filter and //receiver/meta-data elements, respectively.


Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:

The members of Android.Content.BroadcastReceiverAttribute are listed below.

See Also: Attribute

Public Constructors

Constructs and initializes a new BroadcastReceiverAttribute instance.

Public Properties

EnabledBoolean. Whether or not the receiver can be instantiated by the system.
ExportedBoolean. Whether or not the receiver can be launched by components of other applications.
IconString. An icon representing the receiver.
LabelString. A user-readable label for the receiver.
NameString. The name of the class that implements the receiver.
PermissionString. The name of a permission that clients must have to launch the receiver.
ProcessString. The name of the process in which the receiver should run.