Home | History | Annotate | Download | only in manifest
      1 page.title=<manifest>
      2 parent.title=The AndroidManifest.xml File
      3 parent.link=manifest-intro.html
      4 @jd:body
      5 
      6 <dl class="xml">
      7 <dt>syntax:</dt>
      8 <dd><pre class="stx">&lt;manifest xmlns:<a href="#nspace">android</a>="http://schemas.android.com/apk/res/android"
      9           <a href="#package">package</a>="<i>string</i>"
     10           android:<a href="#uid">sharedUserId</a>="<i>string</i>"
     11           android:<a href="#uidlabel">sharedUserLabel</a>="<i>string resource</i>" <!-- ##api level 3## -->
     12           android:<a href="#vcode">versionCode</a>="<i>integer</i>"
     13           android:<a href="#vname">versionName</a>="<i>string</i>"
     14           android:<a href="#install">installLocation</a>=["auto" | "internalOnly" | "preferExternal"] &gt;
     15     . . .
     16 &lt;/manifest&gt;</pre></dd>
     17 
     18 <p>
     19 <dt>contained in:</dt>
     20 <dd><i>none</i></dd>
     21 
     22 <p>
     23 <p>
     24 <dt>must contain:</dt>
     25 <dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></dd>
     26 
     27 <dt>can contain:</dt>
     28 <dd><code><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">&lt;compatible-screens&gt;</a></code>
     29 <br/><code><a href="{@docRoot}guide/topics/manifest/instrumentation-element.html">&lt;instrumentation&gt;</a></code>
     30 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
     31 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
     32 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code>
     33 <br/><code><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture&gt;</a></code>
     34 <br/><code><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a></code>
     35 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></code>  <!-- ##api level 3## -->
     36 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a></code>
     37 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
     38 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-permission-sdk-23-element.html">&lt;uses-permission-sdk-23&gt;</a></code>
     39 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></code></dd>
     40 
     41 <p>
     42 <dt>description:</dt>
     43 <dd itemprop="description">The root element of the AndroidManifest.xml file.  It must
     44 contain an <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element
     45 and specify {@code xmlns:android} and {@code package} attributes.</dd>
     46 
     47 <dt>attributes:</dt>
     48 <dd>
     49 <dl class="attr">
     50 <dt><a name="nspace"></a>{@code xmlns:android}</dt>
     51 <dd>Defines the Android namespace.  This attribute should always be set
     52 to "{@code http://schemas.android.com/apk/res/android}".</dd>
     53 
     54 <dt><a name="package"></a>{@code package}</dt>
     55 <dd>A full Java-language-style package name for the Android application. The
     56   name should be unique.  The name may contain uppercase or lowercase letters
     57   ('A' through 'Z'), numbers, and underscores ('_').  However, individual
     58   package name parts may only start with letters.
     59 
     60 <p>To avoid conflicts with other developers, you should use Internet domain ownership as the
     61 basis for your package names (in reverse). For example, applications published by Google start with
     62 <code>com.google</code>. You should also never use the <code>com.example</code> namespace when
     63 publishing your applications.</p>
     64 
     65   <p>
     66   The package name serves as a unique identifier for the application.
     67   It's also the default name for the application process (see the
     68   <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
     69   element's
     70   <code><a href="{@docRoot}guide/topics/manifest/application-element.html#aff">process</a></code>
     71   process</a></code> attribute) and the default task affinity of an activity
     72   (see the
     73   <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
     74   element's
     75   <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> attribute).
     76   </p>
     77 
     78   <p class="caution"><strong>Caution:</strong> Once you publish your application, you
     79 <strong>cannot change the package name</strong>. The package name defines your application's
     80 identity, so if you change it, then it is considered to be a different application and users of
     81 the previous version cannot update to the new version.</p>
     82 
     83 </dd>
     84 
     85 <dt><a name="uid"></a>{@code android:sharedUserId}</dt>
     86 <dd>The name of a Linux user ID that will be shared with other applications.
     87 By default, Android assigns each application its own unique user ID.
     88 However, if this attribute is set to the same value for two or more applications,
     89 they will all share the same ID &mdash; provided that they are also signed
     90 by the same certificate.  Application with the same user ID can access each
     91 other's data and, if desired, run in the same process.</dd>
     92 
     93 <dt><a name="uidlabel"></a>{@code android:sharedUserLabel}</dt>
     94 <dd>A user-readable label for the shared user ID.  The label must be set as
     95 a reference to a string resource; it cannot be a raw string.
     96 
     97   <p>
     98   <!-- ##api level indication## -->
     99   This attribute was introduced in API Level 3.  It is meaningful only if the
    100   <code><a href="#uid">sharedUserId</a></code> attribute is also set.
    101   </p>
    102 </dd>
    103 
    104 <dt><a name="vcode"></a>{@code android:versionCode}</dt>
    105 <dd>An internal version number.  This number is used only to determine whether
    106 one version is more recent than another, with higher numbers indicating more
    107 recent versions.  This is not the version number shown to users; that number
    108 is set by the {@code versionName} attribute.
    109 
    110   <p>
    111   The value must be set as an integer, such as "100".  You can define it however
    112   you want, as long as each successive version has a higher number.  For example,
    113   it could be a build number.  Or you could translate a version number in "x.y"
    114   format to an integer by encoding the "x" and "y" separately in the lower and
    115   upper 16 bits.  Or you could simply increase the number by one each time a new
    116   version is released.
    117   </p>
    118 </dd>
    119 
    120 <dt><a name="vname"></a>{@code android:versionName}</dt>
    121 <dd>The version number shown to users.  This attribute can be set as a raw
    122 string or as a reference to a string resource.  The string has no other purpose
    123 than to be displayed to users.  The {@code versionCode} attribute holds
    124 the significant version number used internally.
    125 </dd>
    126 
    127 <dt><a name="install"></a>{@code android:installLocation}</dt>
    128 <dd>The default install location for the application.
    129 
    130 <p>The following keyword strings are accepted:</p>
    131 
    132 <table>
    133 <tr>
    134    <th>Value</th>
    135    <th>Description</th>
    136 </tr><tr>
    137    <td>"{@code internalOnly}"</td>
    138    <td>The application must be installed on the internal device storage only. If this is set,
    139 the application will never be installed on the external storage. If the internal
    140 storage is full, then the system will not install the application. This is also the default behavior
    141 if you do not define {@code android:installLocation}.</td>
    142 </tr><tr>
    143    <td>"{@code auto}"</td>
    144    <td>The application may be installed on the external storage, but the system will install the
    145 application on the internal storage by default. If the internal storage is full, then the system
    146 will install it on the external storage. Once installed, the user can move the application
    147 to either internal or external storage through the system settings.</td>
    148 </tr><tr>
    149    <td>"{@code preferExternal}"</td>
    150    <td>The application prefers to be installed on the external storage (SD card). There is no
    151 guarantee that the system will honor this request. The application might be installed on internal
    152 storage if the external media is unavailable or full. Once installed, the user can move the application to
    153 either internal or external storage through the system settings.</td>
    154 </tr>
    155 </table>
    156 
    157 <p class="note"><strong>Note:</strong> By default, your application will be installed on the
    158   internal storage and cannot be installed on the external storage unless you define this attribute
    159   to be either "{@code auto}" or "{@code preferExternal}".</p>
    160 
    161 <p>When an application is installed on the external storage:</p>
    162 <ul>
    163   <li>The {@code .apk} file is saved
    164 to the external storage, but any application data (such as databases) is still saved on
    165 the internal device memory.</li>
    166   <li>The container in which the {@code .apk} file is saved is encrypted with a key that allows
    167 the application to operate only on the device that installed it. (A user cannot
    168 transfer the SD card to another device and use applications installed on the card.) Though,
    169 multiple SD cards can be used with the same device.</li>
    170   <li>At the user's request, the application can be moved to the internal storage.</li>
    171 </ul>
    172 
    173 <p>The user may also request to move an application from the internal storage to the external
    174 storage. However, the system will not allow the user to move the application to external storage if
    175 this attribute is set to {@code internalOnly}, which is the default setting.</p>
    176 
    177 <p>Read <a href="{@docRoot}guide/topics/data/install-location.html">App Install Location</a> for
    178 more information about using this attribute (including how to maintain backward compatibility).</p>
    179 
    180 <p>Introduced in: API Level 8.</p>
    181 
    182 
    183 </dd>
    184 
    185 </dl>
    186 </dd><!-- end attributes -->
    187 
    188 <!-- ##api level indication## -->
    189 <dt>introduced in:</dt>
    190 <dd>API Level 1 for all attributes, unless noted otherwise in the attribute description.</dd>
    191 
    192 <p>
    193 <dt>see also:</dt>
    194 <dd>
    195 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></dd>
    196 
    197 </dl>
    198