Android official documentation: (2) Application List -- 2.19 & lt; Cycler & gt; tag

Source: Internet
Author: User

Syntax:
<receiver android:enabled=["true" | "false"]          android:exported=["true" | "false"]          android:icon="drawable resource"          android:label="string resource"          android:name="string"          android:permission="string"          android:process="string" >    . . .</receiver>
Contained in:
<application>
Can contain:
<intent-filter>
<meta-data>
Description:
Declares a broadcast receiver Er ( BroadcastReceiverSubclass) as one of the application's 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.

There are two ways to make a broadcast guest er known to the system: One isdeclare it in the manifest file with this element. The other is to createthe login er dynamically in code and register it withContext.registerReceiver()Method. SeeBroadcastReceiverClass descriptionfor more on dynamically created receivers.

Attributes:
android:enabled
Whether or not the broadcast receiver er can be instantiated by the system -" true"If it can be, and" false"If not. The default value is" true".

The<application>Element has its ownenabledAttribute that applies to all application components, including broadcast receivers.<application>And<receiver>Attributes must both be"true"For the broadcast receiver er to be enabled. If either is"false", It isdisabled; it cannot be instantiated.

android:exported
Whether or not the broadcast receiver er can receive messages from sources outside its application -" true"If it can, and" false"If not. If" false", The only messages the broadcast receiver er 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 er contains intent filters. the absence of any filters means that it can be invoked only by Intent objects thatspecify its exact class name. this implies that the specified er is intended only for application-internal use (since others wocould 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 er is intended to receive intents broadcast by the system or other applications, so the default value is"true".

This attribute is not the only way to limit a broadcast comment er's external exposure. You can also use a permission to limit the external entities that can send it messages (seepermissionAttribute ).

android:icon
An icon representing the broadcast receiver er. this attribute must be set as a reference to a drawable resource containing the image definition. if it is not set, the icon specified for the application as a whole is used instead (see <application>Element's iconAttribute ).

The broadcast receiver's icon-whether set here or by<application>Element-is also the default icon for all the specified er's intent filters (see<intent-filter>Element'siconAttribute ).

android:label
A user-readable label for the broadcast receiver er. If this attribute is not set, the label set for the application as a whole is used instead (see <application>Element's labelAttribute ).

The broadcast receiver's label-whether set here or by<application>Element-is also the default label for all the specified er's intent filters (see<intent-filter>Element'slabelAttribute ).

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

android:name
The name of the class that implements the broadcast extends er, a subclass BroadcastReceiver. This shoshould be a fully qualified class name (such ," com.example.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 <manifest>Element.

Once you publish your application, you shoshould notchange this name (unless you 've setandroid:exported="false").

There is no default. The name must be specified.

android:permission
The name of a permission that broadcasters must have to send a message to the broadcast receiver. If this attribute is not set, the permission set by <application>Element's permissionAttribute applies to the broadcast receiver er. If neither attribute is set, the specified er is not protected by a permission.

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

android:process
The name of the process in which the broadcast operator er shocould run. normally, all components of an application run in the default process created for the application. it has the same name as the application package. the <application>Element's processAttribute can set a different default for all components. But each component can override the defaultwith its own processAttribute, allowing you to spread your application processing SS multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the broadcast receiver er runs in that process. if the process name begins with a lowercase character, the handler er will 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, cing resource usage.

Introduced in:
API Level 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.