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