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