Home | History | Annotate | Download | only in manifest
      1 page.title=App Manifest
      2 @jd:body
      3 
      4 <div id="qv-wrapper">
      5 <div id="qv">
      6 
      7 <h2>In this document</h2>
      8 <ol>
      9 <li><a href="#filestruct">Manifest file structure</a></li>
     10 <li><a href="#filec">File conventions</a>
     11 <li><a href="#filef">File features</a>
     12     <ol>
     13     <li><a href="#ifs">Intent filters</a></li>
     14     <li><a href="#iconlabel">Icons and labels</a></li>
     15     <li><a href="#perms">Permissions</a></li>
     16     <li><a href="#libs">Libraries</a></li>
     17     </ol></li>
     18 </ol>
     19 </div>
     20 </div>
     21 
     22 <p>
     23   Every application must have an {@code AndroidManifest.xml} file (with precisely that
     24   name) in its root directory. <span itemprop="description">The manifest file
     25   provides essential information about your app to the Android system, which
     26   the system must have before it can run any of the app's
     27   code.</span>
     28 </p>
     29 
     30 <p>
     31 Among other things, the manifest file does the following:
     32 </p>
     33 
     34 <ul>
     35 <li>It names the Java package for the application.
     36 The package name serves as a unique identifier for the application.</li>
     37 
     38 <li>It describes the components of the application, which include the activities,
     39 services, broadcast receivers, and content providers that compose the application.
     40 It also names the classes that implement each of the components and
     41 publishes their capabilities, such as the {@link android.content.Intent
     42 Intent} messages that they can handle. These declarations inform the Android system
     43 of the components and the conditions in which they can be launched.</li>
     44 
     45 <li>It determines the processes that host the application components.</li>
     46 
     47 <li>It declares the permissions that the application must have in order to
     48 access protected parts of the API and interact with other applications. It also declares
     49 the permissions that others are required to have in
     50 order to interact with the application's components.</li>
     51 
     52 <li>It lists the {@link android.app.Instrumentation} classes that provide
     53 profiling and other information as the application runs. These declarations
     54 are present in the manifest only while the application is being developed and
     55 are removed before the application is published.</li>
     56 
     57 <li>It declares the minimum level of the Android API that the application
     58 requires.</li>
     59 
     60 <li>It lists the libraries that the application must be linked against.</li>
     61 </ul>
     62 
     63 <p class="note"><strong>Note</strong>: As you prepare your Android app to run on Chromebooks,
     64 there are some important hardware and software feature limitations that you should consider. See
     65 the <a href="{@docRoot}topic/arc/manifest.html">
     66 App Manifest Compatibility for Chromebooks</a> document for more information.
     67 </p>
     68 
     69 <h2 id="filestruct">Manifest file structure</h2>
     70 
     71 <p>
     72 The code snippet below shows the general structure of the manifest file and
     73 every element that it can contain. Each element, along with all of its
     74 attributes, is fully documented in a separate file.
     75 </p>
     76 
     77 <p class="note"><strong>Tip</strong>: To view detailed
     78 information about any of the elements that are mentioned within the text of this document,
     79 simply click the element name.
     80 </p>
     81 
     82 <p>
     83 Here is an example of the manifest file:
     84 </p>
     85 
     86 <pre>
     87 &lt;?xml version="1.0" encoding="utf-8"?&gt;
     88 
     89 <a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a>
     90 
     91     <a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission /&gt;</a>
     92     <a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission /&gt;</a>
     93     <a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree /&gt;</a>
     94     <a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group /&gt;</a>
     95     <a href="{@docRoot}guide/topics/manifest/instrumentation-element.html">&lt;instrumentation /&gt;</a>
     96     <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk /&gt;</a>
     97     <a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration /&gt;</a>  <!-- ##api level 3## -->
     98     <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature /&gt;</a>  <!-- ##api level 4## -->
     99     <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens /&gt;</a>  <!-- ##api level 4## -->
    100     <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">&lt;compatible-screens /&gt;</a>  <!-- ##api level 9## -->
    101     <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture /&gt;</a>  <!-- ##api level 11## -->
    102 
    103     <a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a>
    104 
    105         <a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a>
    106             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a>
    107                 <a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action /&gt;</a>
    108                 <a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category /&gt;</a>
    109                 <a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data /&gt;</a>
    110             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    111             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    112         <a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;/activity&gt;</a>
    113 
    114         <a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a>
    115             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    116             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    117         <a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;/activity-alias&gt;</a>
    118 
    119         <a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a>
    120             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    121             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data/&gt;</a>
    122         <a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;/service&gt;</a>
    123 
    124         <a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a>
    125             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    126             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    127         <a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;/receiver&gt;</a>
    128 
    129         <a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a>
    130             <a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission /&gt;</a>
    131             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    132             <a href="{@docRoot}guide/topics/manifest/path-permission-element.html">&lt;path-permission /&gt;</a>
    133         <a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;/provider&gt;</a>
    134 
    135         <a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library /&gt;</a>
    136 
    137     <a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;/application&gt;</a>
    138 
    139 <a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;/manifest&gt;</a>
    140 </pre>
    141 
    142 <p>
    143 The following list contains all of the elements that can appear in the manifest file,
    144 in alphabetical order:
    145 </p>
    146 
    147 <ul>
    148  <li><code><a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action&gt;</a></code></li>
    149  <li><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code></li>
    150  <li><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code></li>
    151  <li><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></li>
    152  <li><code><a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category&gt;</a></code></li>
    153  <li><code><a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data&gt;</a></code></li>
    154  <li><code><a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission&gt;</a></code></li>
    155  <li><code><a href="{@docRoot}guide/topics/manifest/instrumentation-element.html">&lt;instrumentation&gt;</a></code></li>
    156  <li><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code></li>
    157  <li><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></li>
    158  <li><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code></li>
    159  <li><code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code></li>
    160  <li><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code></li>
    161  <li><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code></li>
    162  <li><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></li>
    163  <li><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code></li>
    164  <li><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code></li>
    165  <li><code><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a></code>  <!-- ##api level 4## --></li>
    166  <li><code><a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></code>  <!-- ##api level 3## --></li>
    167  <li><code><a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a></code>  <!-- ##api level 4## --></li>
    168  <li><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code></li>
    169  <li><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code></li>
    170  <li><code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></code></li>
    171 </ul>
    172 
    173 <p class="note"><strong>Note</strong>: These are the only legal elements &ndash; you cannot
    174 add your own elements or attributes.
    175 </p>
    176 
    177 <h2 id="filec">File conventions</h2>
    178 
    179 <p>
    180 This section describes the conventions and rules that apply generally to all of the elements and
    181 attributes in the manifest file.
    182 </p>
    183 
    184 <dl>
    185 <dt><b>Elements</b></dt>
    186 <dd>Only the
    187 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> and
    188 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    189 elements are required. They each must be present and can occur only once.
    190 Most of the other elements can occur many times or not at all. However, at
    191 least some of them must be present before the manifest file becomes useful.
    192 
    193 <p>
    194 If an element contains anything at all, it contains other elements.
    195 All of the values are set through attributes, not as character data within an element.
    196 </p>
    197 
    198 <p>
    199 Elements at the same level are generally not ordered. For example, the
    200 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>,
    201 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>, and
    202 <code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
    203 elements can be intermixed in any sequence. There are two key exceptions to this
    204 rule:
    205 <ul>
    206   <li>
    207     An <code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
    208     element must follow the
    209     <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
    210     for which it is an alias.
    211   </li>
    212   <li>
    213     The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    214     element must be the last element inside the
    215     <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>
    216     element. In other words, the <code>&lt;/application&gt;</code> closing tag
    217     must appear immediately before the <code>&lt;/manifest&gt;</code> closing
    218     tag.
    219   </li>
    220 </p></dd>
    221 
    222 <dt><b>Attributes</b></dt>
    223 <dd>In a formal sense, all attributes are optional. However, there are some attributes
    224 that must be specified so that an element can accomplish its purpose. Use the
    225 documentation as a guide. For truly optional attributes, it mentions a default
    226 value or states what happens in the absence of a specification.
    227 
    228 <p>Except for some attributes of the root
    229 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>
    230 element, all attribute names begin with an {@code android:} prefix.
    231 For example, {@code android:alwaysRetainTaskState}. Because the prefix is
    232 universal, the documentation generally omits it when referring to attributes
    233 by name.</p></dd>
    234 
    235 <dt><b>Declaring class names</b></dt>
    236 <dd>Many elements correspond to Java objects, including elements for the
    237 application itself (the
    238 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    239 element) and its principal components: activities
    240 (<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>),
    241 services
    242 (<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>),
    243 broadcast receivers
    244 (<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>),
    245 and content providers
    246 (<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>).
    247 
    248 <p>
    249 If you define a subclass, as you almost always would for the component classes
    250 ({@link android.app.Activity}, {@link android.app.Service},
    251 {@link android.content.BroadcastReceiver}, and {@link android.content.ContentProvider}),
    252 the subclass is declared through a {@code name} attribute.  The name must include
    253 the full package designation.
    254 For example, a {@link android.app.Service} subclass might be declared as follows:
    255 </p>
    256 
    257 <pre>&lt;manifest . . . &gt;
    258     &lt;application . . . &gt;
    259         &lt;service android:name="com.example.project.SecretService" . . . &gt;
    260             . . .
    261         &lt;/service&gt;
    262         . . .
    263     &lt;/application&gt;
    264 &lt;/manifest&gt;</pre>
    265 
    266 <p>
    267 However, if the first character of the string is a period, the
    268 application's package name (as specified by the
    269 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>
    270 element's
    271 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html#package">package</a></code>
    272 attribute) is appended to the string. The following assignment is the same as that shown above:
    273 </p>
    274 
    275 <pre>&lt;manifest package="com.example.project" . . . &gt;
    276     &lt;application . . . &gt;
    277         &lt;service android:name=".SecretService" . . . &gt;
    278             . . .
    279         &lt;/service&gt;
    280         . . .
    281     &lt;/application&gt;
    282 &lt;/manifest&gt;</pre>
    283 
    284 <p>
    285 When starting a component, the Android system creates an instance of the named subclass.
    286 If a subclass isn't specified, it creates an instance of the base class.
    287 </p></dd>
    288 
    289 <dt><b>Multiple values</b></dt>
    290 <dd>If more than one value can be specified, the element is almost always
    291 repeated, rather than multiple values being listed within a single element.
    292 For example, an intent filter can list several actions:
    293 
    294 <pre>&lt;intent-filter . . . &gt;
    295     &lt;action android:name="android.intent.action.EDIT" /&gt;
    296     &lt;action android:name="android.intent.action.INSERT" /&gt;
    297     &lt;action android:name="android.intent.action.DELETE" /&gt;
    298     . . .
    299 &lt;/intent-filter&gt;</pre></dd>
    300 
    301 <dt><b>Resource values</b></dt>
    302 <dd>Some attributes have values that can be displayed to users, such as
    303 a label and an icon for an activity. The values of these attributes
    304 should be localized and set from a resource or theme. Resource
    305 values are expressed in the following format:</p>
    306 
    307 <p style="margin-left: 2em">{@code @[<i>package</i>:]<i>type</i>/<i>name</i>}</p>
    308 
    309 <p>
    310 You can ommit the <i>package</i> name if the resource is in the same package
    311 as the application. The <i>type</i> is a type of resource, such as <em>string</em> or
    312 <em>drawable</em>, and the <i>name</i> is the name that identifies the specific resource.
    313 Here is an example:
    314 </p>
    315 
    316 <pre>&lt;activity android:icon="@drawable/smallPic" . . . &gt</pre>
    317 
    318 <p>
    319 The values from a theme are expressed similarly, but with an initial {@code ?}
    320 instead of {@code @}:
    321 </p>
    322 
    323 <p style="margin-left: 2em">{@code ?[<i>package</i>:]<i>type</i>/<i>name</i>}
    324 </p></dd>
    325 
    326 <dt><b>String values</b></dt>
    327 <dd>Where an attribute value is a string, you must use double backslashes ({@code \\})
    328 to escape characters, such as {@code \\n} for
    329 a newline or {@code \\uxxxx} for a Unicode character.</dd>
    330 </dl>
    331 
    332 <h2 id="filef">File features</h2>
    333 
    334 <p>
    335 The following sections describe the way that some Android features are reflected
    336 in the manifest file.
    337 </p>
    338 
    339 
    340 <h3 id="ifs">Intent filters</h3>
    341 
    342 <p>
    343 The core components of an application, such as its activities, services, and broadcast
    344 receivers, are activated by <i>intents</i>. An intent is a
    345 bundle of information (an {@link android.content.Intent} object) describing a
    346 desired action, including the data to be acted upon, the category of
    347 component that should perform the action, and other pertinent instructions.
    348 The Android system locates an appropriate component that can respond to the intent, launches
    349 a new instance of the component if one is needed, and passes it the
    350 {@link android.content.Intent} object.
    351 </p>
    352 
    353 <p>
    354 The components advertise the types of intents that they can
    355 respond to through <i>intent filters</i>. Since the Android system
    356 must learn the intents that a component can handle before it launches the component,
    357 intent filters are specified in the manifest as
    358 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
    359 elements. A component can have any number of filters, each one describing
    360 a different capability.
    361 </p>
    362 
    363 <p>
    364 An intent that explicitly names a target component activates that component, so
    365 the filter doesn't play a role. An intent that doesn't specify a target by
    366 name can activate a component only if it can pass through one of the component's
    367 filters.
    368 </p>
    369 
    370 <p>
    371 For information about how {@link android.content.Intent} objects are tested against intent filters,
    372 see the <a href="{@docRoot}guide/components/intents-filters.html">Intents
    373 and Intent Filters</a> document.
    374 </p>
    375 
    376 <h3 id="iconlabel">Icons and labels</h3>
    377 
    378 <p>
    379 A number of elements have {@code icon} and {@code label} attributes for a
    380 small icon and a text label that can be displayed to users. Some also have a
    381 {@code description} attribute for longer, explanatory text that can also be
    382 shown on-screen. For example, the
    383 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    384 element has all three of these attributes so that when the user is asked whether
    385 to grant the permission to an application that has requested it, an icon representing
    386 the permission, the name of the permission, and a description of what it
    387 entails are all presented to the user.
    388 </p>
    389 
    390 <p>
    391 In every case, the icon and label that are set in a containing element become the default
    392 {@code icon} and {@code label} settings for all of the container's subelements.
    393 Thus, the icon and label that are set in the
    394 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    395 element are the default icon and label for each of the application's components.
    396 Similarly, the icon and label that are set for a component, such as an
    397 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
    398 element, are the default settings for each of the component's
    399 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
    400 elements. If an
    401 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    402 element sets a label, but an activity and its intent filter do not,
    403 the application label is treated as the label for both the activity and
    404 the intent filter.
    405 </p>
    406 
    407 <p>
    408 The icon and label that are set for an intent filter represent a component
    409 whenever the component is presented to the user and fulfills the function
    410 that is advertised by the filter. For example, a filter with
    411 {@code android.intent.action.MAIN} and
    412 {@code android.intent.category.LAUNCHER} settings advertises an activity
    413 as one that initiates an application. That is, as
    414 one that should be displayed in the application launcher. The icon and label
    415 that are set in the filter are displayed in the launcher.
    416 </p>
    417 
    418 <h3 id="perms">Permissions</h3>
    419 
    420 <p>
    421 A <i>permission</i> is a restriction that limits access to a part of the code
    422 or to data on the device. The limitation is imposed to protect critical
    423 data and code that could be misused to distort or damage the user experience.
    424 </p>
    425 
    426 <p>
    427 Each permission is identified by a unique label. Often the label indicates
    428 the action that's restricted. Here are some permissions that are defined
    429 by Android:
    430 </p>
    431 
    432 <ul>
    433   <li>{@code android.permission.CALL_EMERGENCY_NUMBERS}</li>
    434   <li>{@code android.permission.READ_OWNER_DATA}</li>
    435   <li>{@code android.permission.SET_WALLPAPER}</li>
    436   <li>{@code android.permission.DEVICE_POWER}</li>
    437 </ul>
    438 
    439 <p>
    440 A feature can be protected by only one permission.
    441 </p>
    442 
    443 <p>
    444 If an application needs access to a feature that is protected by a permission,
    445 it must declare that it requires the permission with a
    446 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
    447 element in the manifest. When the application is installed on
    448 the device, the installer determines whether to grant the requested
    449 permission by checking the authorities that signed the application's
    450 certificates and, in some cases, asking the user.
    451 If the permission is granted, the application is able to use the protected
    452 features. If not, its attempts to access those features fail
    453 without any notification to the user.
    454 </p>
    455 
    456 <p>
    457 An application can also protect its own components with permissions. It can employ
    458 any of the permissions that are defined by Android, as listed in
    459 {@link android.Manifest.permission android.Manifest.permission}, or declared
    460 by other applications. It can also define its own. A new permission is declared
    461 with the
    462 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    463 element. For example, an activity could be protected as follows:
    464 </p>
    465 
    466 <pre>
    467 &lt;manifest . . . &gt;
    468     &lt;permission android:name="com.example.project.DEBIT_ACCT" . . . /&gt;
    469     &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
    470     . . .
    471     &lt;application . . .&gt;
    472         &lt;activity android:name="com.example.project.FreneticActivity"
    473                   android:permission="com.example.project.DEBIT_ACCT"
    474                   . . . &gt;
    475             . . .
    476         &lt;/activity&gt;
    477     &lt;/application&gt;
    478 &lt;/manifest&gt;
    479 </pre>
    480 
    481 <p>
    482 Note that, in this example, the {@code DEBIT_ACCT} permission is not only
    483 declared with the
    484 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    485 element, its use is also requested with the
    486 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
    487 element. You must request its use in order for other components of the
    488 application to launch the protected activity, even though the protection
    489 is imposed by the application itself.
    490 </p>
    491 
    492 <p>
    493 If, in the same example shown above, the {@code permission} attribute was set to a
    494 permission that is declared elsewhere,
    495 such as {@code android.permission.CALL_EMERGENCY_NUMBERS}, it would not
    496 be necessary to declare it again with a
    497 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    498 element. However, it would still be necessary to request its use with
    499 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>.
    500 </p>
    501 
    502 <p>
    503 The
    504 <code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code>
    505 element declares a namespace for a group of permissions that are defined in
    506 code, and the
    507 <code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
    508 defines a label for a set of permissions, both those declared in the manifest with
    509 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    510 elements and those declared elsewhere. This affects only how the permissions are
    511 grouped when presented to the user. The
    512 <code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
    513 element does not specify the permissions that belong to the group, but
    514 it gives the group a name. You can place a permission in the group
    515 by assigning the group name to the
    516 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    517 element's
    518 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html#pgroup">permissionGroup</a></code>
    519 attribute.
    520 </p>
    521 
    522 
    523 <h3 id="libs">Libraries</h3>
    524 
    525 <p>
    526 Every application is linked against the default Android library, which
    527 includes the basic packages for building applications (with common classes
    528 such as Activity, Service, Intent, View, Button, Application, and ContentProvider).
    529 </p>
    530 
    531 <p>
    532 However, some packages reside in their own libraries. If your application
    533 uses code from any of these packages, it must explicitly ask to be linked
    534 against them. The manifest must contain a separate
    535 <code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code>
    536 element to name each of the libraries. You can find the library name in the
    537 documentation for the package.
    538 </p>
    539