system must have before it can run any of the application's code. Among other things, the manifest does the following:
- It names the Java package for the application. The package name serves as a unique identifier for the application.
- 声明了此程序的包名称,包名称作为此程序的唯一性表识。
- It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example,
which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched. - 清单还描述了次程序的各个组件-程序包含的活动,服务,广播接收器和内容提供者。它声明了实现各个组件的类并发布了它们的能力(比如,那个Intent的消息可以被处理)。这些声明让安卓系统知道都有那些组件以及在什么条件下可以激活这些组件。
- It determines which processes will host application components.
- 它决定了那些进程将托管应用程序的组件。
- It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
- 它决定了程序为了访问受限的API和其他程序必须拥有哪些权限。
- It also declares the permissions that others are required to have in order to interact with the application's components.
- 它也决定了其他程序为了访问本程序组件需要哪些权限。
- It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the
manifest only while the application is being developed and tested; they're removed before the application is published. - 它列出了Instrumentation类,在程序运行时提供日至及其他信息。声明的类仅在开发和测试过程中有效,在发布时将被移除。
- It declares the minimum level of the Android API that the application requires.
- 它声明了程序要求的最小安卓系统级别。
- It lists the libraries that the application must be linked against.
- 它声明了程序所需链接的库。
information about any element, click on the element name in the diagram, in the alphabetical list of elements that follows the diagram, or on any other mention of the element name.
<uses-permission />
<permission />
<permission-tree />
<permission-group />
<instrumentation />
<uses-sdk />
<uses-configuration />
<uses-feature />
<supports-screens />
<compatible-screens />
<supports-gl-texture />
<activity>
<intent-filter>
<action />
<category />
<data />
</intent-filter>
<meta-data />
</activity>
<activity-alias>
<intent-filter> . . . </intent-filter>
<meta-data />
</activity-alias>
<service>
<intent-filter> . . . </intent-filter>
<meta-data/>
</service>
<receiver>
<intent-filter> . . . </intent-filter>
<meta-data />
</receiver>
<provider>
<grant-uri-permission />
<meta-data />
<path-permission />
</provider>
are required, they each must be present and can occur only once. Most of the others can occur many times or not at all — although at least some of them must be present for the manifest to accomplish anything meaningful.
and<service> elements can be intermixed in any sequence. (An <activity-alias> element
is the exception to this rule: It must follow the <activity> it is an alias for.)
和<service> 元素可以以任何顺序出现。( <activity-alias> 元素是个例外,它必须跟在它所引用的<activity> 后面。)
a default value or states what happens in the absence of a specification.
— for example, android:alwaysRetainTaskState. Because the prefix is universal, the documentation generally omits it when referring to attributes by name.
and its principal components — activities (<activity>), services (<service>),
broadcast receivers (<receiver>), and content providers (<provider>).
服务 (<service>), 广播接收者 (<receiver>), 和内容提供者 (<provider>).
and ContentProvider), the subclass is declared through a name attribute. The name must include the full package designation. For example, an Service subclass
might be declared as follows:
和 ContentProvider),这个子类通过一个name属性声明。这个名称必须包含完成的包路径。比如,一个服务子类声明如下:
<application . . . ]]
<service android:name="com.example.project.SecretService" . . . ]]
. . .
</service>
. . .
</application>
</manifest>
The following assignment is the same as the one above:
<application . . . ]]
<service android:name=".SecretService" . . . ]]
. . .
</service>
. . .
</application>
</manifest>
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.INSERT" />
<action android:name="android.intent.action.DELETE" />
. . .
</intent-filter>
values are expressed in the following format,
identifies the specific resource. For example:
describing a desired action — including the data to be acted upon, the category of component that should perform the action, and other pertinent instructions. Android locates an appropriate component to respond to the intent, launches a new instance of the
component if one is needed, and passes it the Intent object.
the component, intent filters are specified in the manifest as <intent-filter> elements. A component may have any number of filters, each one describing
a different capability.
through one of the component's filters.
Filters.
For example, the <permission> element has all three of these attributes, so that when the user is asked whether to grant the permission to an application
that has requested it, an icon representing the permission, the name of the permission, and a description of what it entails can all be presented to the user.
are the default icon and label for each of the application's components. Similarly, the icon and label set for a component — for example, an <activity> element
— are the default settings for each of the component's <intent-filter>elements. If an <application> element
sets a label, but an activity and its intent filter do not, the application label is treated as the label for both the activity and the intent filter.
and "android.intent.category.LAUNCHER" settings advertises an activity as one that initiates an application — that is, as one that should be displayed in the application launcher. The icon and label set in the filter are therefore the ones displayed in the
launcher.
user experience.
in the manifest. Then, when the application is installed on the device, the installer determines whether or not to grant the requested permission by checking the authorities that signed the application's certificates and, in some cases, asking the user. If
the permission is granted, the application is able to use the protected features. If not, its attempts to access those features will simply fail without any notification to the user.
or declared by other applications. Or it can define its own. A new permission is declared with the <permission> element. For example, an activity could
be protected as follows:
<permission android:name="com.example.project.DEBIT_ACCT" . . . />
<uses-permission android:name="com.example.project.DEBIT_ACCT" />
. . .
<application . . .]]
<activity android:name="com.example.project.FreneticActivity"
android:permission="com.example.project.DEBIT_ACCT"
. . . ]]
. . .
</activity>
</application>
</manifest>
its use is also requested with the <uses-permission> element. Its use must be requested in order for other components of the application to launch
the protected activity, even though the protection is imposed by the application itself.
However, it would still have been necessary to request its use with <uses-permission>.
code. And <permission-group> defines a label for a set of permissions (both those declared in the manifest with<permission> elements
and those declared elsewhere). It affects only how the permissions are grouped when presented to the user. The <permission-group> element does not
specify which permissions belong to the group; it just gives the group a name. A permission is placed in the group by assigning the group name to the<permission> element's permissionGroup attribute.
and so on).
to name each of the libraries. (The library name can be found in the documentation for the package.)