application-element.jd revision c3e54987044d92f8e8d0fea1ce31b505bb0afb12
1page.title=<application>
2
3@jd:body
4
5<dl class="xml">
6<dt>syntax:</dt>
7<dd><pre class="stx">&lt;application android:<a href="#reparent">allowTaskReparenting</a>=["true" | "false"]
8             android:<a href="#allowbackup">allowBackup</a>=["true" | "false"]
9             android:<a href="#agent">backupAgent</a>="<i>string</i>"
10             android:<a href="#debug">debuggable</a>=["true" | "false"]
11             android:<a href="#desc">description</a>="<i>string resource</i>"
12             android:<a href="#enabled">enabled</a>=["true" | "false"]
13             android:<a href="#code">hasCode</a>=["true" | "false"]
14             android:<a href="#hwaccel">hardwareAccelerated</a>=["true" | "false"]
15             android:<a href="#icon">icon</a>="<i>drawable resource</i>"
16             android:<a href="#killrst">killAfterRestore</a>=["true" | "false"]
17             android:<a href="#largeHeap">largeHeap</a>=["true" | "false"]
18             android:<a href="#label">label</a>="<i>string resource</i>"
19             android:<a href="#logo">logo</a>="<i>drawable resource</i>"
20             android:<a href="#space">manageSpaceActivity</a>="<i>string</i>"
21             android:<a href="#nm">name</a>="<i>string</i>"
22             android:<a href="#prmsn">permission</a>="<i>string</i>"
23             android:<a href="#persistent">persistent</a>=["true" | "false"]
24             android:<a href="#proc">process</a>="<i>string</i>"
25             android:<a href="#restoreany">restoreAnyVersion</a>=["true" | "false"]
26             android:<a href="#requiredAccountType">requiredAccountType</a>="<i>string</i>"
27             android:<a href="#restrictedAccountType">restrictedAccountType</a>="<i>string</i>"
28             android:<a href="#supportsrtl">supportsRtl</a>=["true" | "false"]
29             android:<a href="#aff">taskAffinity</a>="<i>string</i>"
30             android:<a href="#testOnly">testOnly</a>=["true" | "false"]
31             android:<a href="#theme">theme</a>="<i>resource or theme</i>"
32             android:<a href="#uioptions">uiOptions</a>=["none" | "splitActionBarWhenNarrow"]
33             android:<a href="#vmSafeMode">vmSafeMode</a>=["true" | "false"] &gt;
34    . . .
35&lt;/application&gt;</pre></dd>
36
37<dt>contained in:</dt>
38<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
39
40<dt>can contain:</dt>
41<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
42<br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
43<br/><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code>
44<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
45<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
46<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>
47<br/><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code></dd>
48
49<dt>description:</dt>
50<dd>The declaration of the application.  This element contains subelements 
51that declare each of the application's components and has attributes 
52that can affect all the components.  Many of these attributes (such as 
53{@code icon}, {@code label}, {@code permission}, {@code process}, 
54{@code taskAffinity}, and {@code allowTaskReparenting}) set default values 
55for corresponding attributes of the component elements.  Others (such as
56{@code debuggable}, {@code enabled}, {@code description}, and 
57{@code allowClearUserData})  set values for the application as a whole and 
58cannot be overridden by the components.</dd>
59
60
61
62
63
64<dt>attributes</dt>
65<dd><dl class="attr">
66
67<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
68<dd>Whether or not activities that the application defines can move from 
69the task that started them to the task they have an affinity for when that task 
70is next brought to the front &mdash; {@code "true"} if they can move, and 
71{@code "false"} if they must remain with the task where they started.  
72The default value is {@code "false"}.
73
74<p>
75The 
76<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
77element has its own 
78<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code>
79attribute that can override the value set here.  See that attribute for more 
80information.
81</p></dd>
82
83
84<dt><a name="allowbackup"></a>{@code android:allowbackup}</dt>
85<dd>Whether to allow the application to participate in the backup
86and restore infrastructure. If this attribute is set to false, no backup
87or restore of the application will ever be performed, even by a full-system
88backup that would otherwise cause all application data to be saved via adb.
89The default value of this attribute is true.</dd>
90
91
92<dt><a name="agent"></a>{@code android:backupAgent}</dt>
93<dd>The name of the class that implement's the application's backup agent,
94a subclass of {@link android.app.backup.BackupAgent}.  The attribute value should be
95a fully qualified  class name (such as, {@code "com.example.project.MyBackupAgent"}).  
96However, as a shorthand, if the first character of the name is a period 
97(for example, {@code ".MyBackupAgent"}), it is appended to the 
98package name specified in the 
99<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
100element.
101
102<p>
103There is no default.  The name must be specified.
104</p></dd>
105
106<dt><a name="debug"></a>{@code android:debuggable}</dt>
107<dd>Whether or not the application can be debugged, even when running 
108on a device in user mode &mdash; {@code "true"} if it can be, and {@code "false"}
109if not.  The default value is {@code "false"}.</dd> 
110
111<dt><a name="desc"></a>{@code android:description}</dt>
112<dd>User-readable text about the application, longer and more descriptive than the application label.  The value must be set as a reference to a string resource.  Unlike the label, it cannot be a raw string.  There is no default value.</dd>
113
114<dt><a name="enabled"></a>{@code android:enabled}</dt>
115<dd>Whether or not the Android system can instantiate components of 
116the application &mdash; {@code "true"} if it can, and {@code "false"} 
117if not.  If the value is {@code "true"}, each component's 
118{@code enabled} attribute determines whether that component is enabled 
119or not.  If the value is {@code "false"}, it overrides the 
120component-specific values; all components are disabled.
121
122<p>
123The default value is {@code "true"}.
124</p></dd>  
125
126<dt><a name="code"></a>{@code android:hasCode}</dt>
127<dd>Whether or not the application contains any code &mdash; {@code "true"} 
128if it does, and {@code "false"} if not.  When the value is {@code "false"}, 
129the system does not try to load any application code when launching components.  
130The default value is {@code "true"}.
131
132<p>
133An application would not have any code of its own only if it's using nothing
134but built-in component classes, such as an activity that uses the {@link 
135android.app.AliasActivity} class, a rare occurrence.</p>
136</dd>
137
138<dt><a name="hwaccel"></a>{@code android:hardwareAccelerated}</dt>
139<dd>Whether or not hardware-accelerated rendering should be enabled for all
140activities and views in this application &mdash; {@code "true"} if it
141should be enabled, and {@code "false"} if not. The default value is {@code "true"} if you've set
142either <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a>
143or <a 
144href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a>
145to {@code "14"} or higher; otherwise, it's {@code "false"}.
146
147<p>Starting from Android 3.0 (API level 11), a hardware-accelerated OpenGL renderer is
148available to applications, to improve performance for many common 2D graphics
149operations. When the hardware-accelerated renderer is enabled, most operations
150in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated.
151This results in smoother animations, smoother scrolling, and improved
152responsiveness overall, even for applications that do not explicitly make use
153the framework's OpenGL libraries. </p>
154
155<p>Note that not all of the OpenGL 2D operations are accelerated. If you enable
156the hardware-accelerated renderer, test your application to ensure that it can
157make use of the renderer without errors.</p>
158
159<p>For more information, read the <a href="{@docRoot}guide/topics/graphics/hardware-accel.html"
160>Hardware Acceleration</a> guide.</p>
161</dd>
162
163<dt><a name="icon"></a>{@code android:icon}</dt>
164<dd>An icon for the application as whole, and the default icon for 
165each of the application's components.  See the individual 
166{@code icon} attributes for 
167<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
168<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
169<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
170<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
171<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
172
173<p>
174This attribute must be set as a reference to a drawable resource containing
175the image (for example {@code "@drawable/icon"}). There is no default icon.
176</p></dd>
177
178<dt><a name="killrst"></a>{@code android:killAfterRestore}</dt>
179<dd>Whether the application in question should be terminated after its
180settings have been restored during a full-system restore operation.
181Single-package restore operations will never cause the application to
182be shut down.  Full-system restore operations typically only occur once,
183when the phone is first set up.  Third-party applications will not normally
184need to use this attribute.
185
186<p>The default is {@code true}, which means that after the application
187has finished processing its data during a full-system restore, it will be
188terminated.
189</p></dd>
190
191<dt><a name="largeHeap"></a>{@code android:largeHeap}</dt>
192<dd>Whether your application's processes should be created with a large Dalvik heap. This applies to
193all processes created for the application. It only applies to the first application loaded into a
194process; if you're using a shared user ID to allow multiple applications to use a process, they all
195must use this option consistently or they will have unpredictable results.
196<p>Most apps should not need this and should instead focus on reducing their overall memory usage for
197improved performance. Enabling this also does not guarantee a fixed increase in available memory,
198because some devices are constrained by their total available memory.</p>
199<p>To query the available memory size at runtime, use the methods {@link
200  android.app.ActivityManager#getMemoryClass()} or {@link
201  android.app.ActivityManager#getLargeMemoryClass()}.</p>
202</dd>
203
204<dt><a name="label"></a>{@code android:label}</dt>
205<dd>A user-readable label for the application as a whole, and a default 
206label for each of the application's components.  See the individual 
207{@code label} attributes for 
208<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
209<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
210<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
211<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
212<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
213
214<p>
215The label should be set as a reference to a string resource, so that
216it can be localized like other strings in the user interface.  
217However, as a convenience while you're developing the application, 
218it can also be set as a raw string.
219</p></dd>
220
221<dt><a name="logo"></a>{@code android:logo}</dt>
222<dd>A logo for the application as whole, and the default logo for activities.
223<p>This attribute must be set as a reference to a drawable resource containing
224the image (for example {@code "@drawable/logo"}).  There is no default logo.</p></dd>
225
226<dt><a name="space"></a>{@code android:manageSpaceActivity}</dt>
227<dd>The fully qualified name of an Activity subclass that the system 
228can launch to let users manage the memory occupied by the application 
229on the device.  The activity should also be declared with an 
230<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element.
231</dd>
232
233<dt><a name="nm"></a>{@code android:name}</dt>
234<dd>The fully qualified name of an {@link android.app.Application} 
235subclass implemented for the application.  When the application process 
236is started, this class is instantiated before any of the application's 
237components.  
238
239<p>
240The subclass is optional; most applications won't need one.
241In the absence of a subclass, Android uses an instance of the base 
242Application class.
243</p></dd>
244
245<dt><a name="prmsn"></a>{@code android:permission}</dt>
246<dd>The name of a permission that clients must have in order to interact 
247with the application.  This attribute is a convenient way to set a 
248permission that applies to all of the application's components.  It can 
249be overwritten by setting the {@code permission} attributes of individual 
250components.
251
252<p>
253For more information on permissions, see the 
254<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a> 
255section in the introduction and another document, 
256<a href="{@docRoot}guide/topics/security/security.html">Security and
257Permissions</a>.
258</p></dd>
259
260<dt><a name="persistent"></a>{@code android:persistent}</dt>
261<dd>Whether or not the application should remain running at all times &mdash; 
262{@code "true"} if it should, and {@code "false"} if not.  The default value 
263is {@code "false"}.  Applications should not normally set this flag; 
264persistence mode is intended only for certain system applications.</dd>
265
266<dt><a name="proc"></a>{@code android:process}</dt>
267<dd>The name of a process where all components of the application should run.
268Each component can override this default by setting its own {@code process}
269attribute.
270
271<p>
272By default, Android creates a process for an application when the first
273of its components needs to run.  All components then run in that process.
274The name of the default process matches the package name set by the
275<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
276</p>
277
278<p>By setting this attribute to a process name that's shared with another
279application, you can arrange for components of both applications to run in
280the same process &mdash; but only if the two applications also share a
281user ID and be signed with the same certificate.
282</p>
283
284<p>
285If the name assigned to this attribute begins with a colon (':'), a new 
286process, private to the application, is created when it's needed.
287If the process name begins with a lowercase character, a global process 
288of that name is created.  A global process can be shared with other
289applications, reducing resource usage.
290</p></dd>
291
292<dt><a name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
293<dd>Indicates that the application is prepared to attempt a restore of any
294backed-up data set, even if the backup was stored by a newer version
295of the application than is currently installed on the device.  Setting
296this attribute to {@code true} will permit the Backup Manager to
297attempt restore even when a version mismatch suggests that the data are
298incompatible.  <em>Use with caution!</em>
299
300<p>The default value of this attribute is {@code false}.
301</p></dd>
302
303
304
305<dt><a name="requiredAccountType"></a>{@code android:requiredAccountType}</dt>
306<dd>Specifies the account type required by the application in order to function.
307If your app requires an {@link android.accounts.Account}, the value for this attribute must
308correspond to the account authenticator
309type used by your app (as defined by {@link android.accounts.AuthenticatorDescription}),
310such as "com.google".  
311
312<p>The default value is null and indicates that the application
313can work <em>without</em> any accounts.
314
315<p>Because restricted profiles currently
316cannot add accounts, specifying this attribute <strong>makes your app
317unavailable from a restricted profile</strong> unless you also declare
318<a href="#restrictedAccountType">{@code android:restrictedAccountType}</a> with
319the same value.</p>
320
321<p class="caution"><strong>Caution:</strong>
322If the account data may reveal personally identifiable information, it's important
323that you declare this attribute and leave <a href="#restrictedAccountType">{@code android:restrictedAccountType}</a> null, so that restricted profiles cannot use
324your app to access personal information that belongs to the owner user.</p>
325
326<p>This attribute was added in API level 18.</p>
327</dd>
328
329
330<dt><a name="restrictedAccountType"></a>{@code android:restrictedAccountType}</dt>
331<dd>Specifies the account type required by this application and indicates that restricted profiles
332are allowed to access such accounts that belong to the owner user. If your app requires an
333{@link android.accounts.Account} and restricted profiles <strong>are allowed to
334access</strong> the primary user's accounts, the value for this attribute must
335correspond to the account authenticator type used by your app (as
336defined by {@link android.accounts.AuthenticatorDescription}), such as "com.google".
337
338<p>The default value is null and indicates that the application can work <em>without</em> any
339accounts.
340
341<p class="caution"><strong>Caution:</strong>
342Specifying this attribute allows restricted profiles to use your
343app with accounts that belong to the owner user, which may reveal personally identifiable
344information. If the account may reveal personal details, you <strong>should not</strong>
345use this attribute and you should instead declare the <a
346href="#requiredAccountType">{@code android:requiredAccountType}</a> attribute
347to make your app unavailable to restricted profiles.</p>
348
349<p>This attribute was added in API level 18.</p>
350</dd>
351
352
353
354<dt><a name="supportsrtl"></a>{@code android:supportsRtl}</dt>
355<dd>Declares whether your application is willing to support right-to-left (RTL) layouts.
356<p>If set to {@code true} and <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target"
357>{@code targetSdkVersion}</a> is set to 17 or higher, various RTL APIs will be
358activated and used by the system so your app can display RTL layouts.
359If set to {@code false} or if <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target"
360>{@code targetSdkVersion}</a> is set to 16 or lower, the RTL APIs will be ignored
361or will have no effect and your app will behave the same regardless of the layout
362direction associated to the user's Locale choice (your layouts will always be left-to-right).
363
364<p>The default value of this attribute is {@code false}.</p>
365
366<p>This attribute was added in API level 17.</p>
367</dd>
368
369<dt><a name="aff"></a>{@code android:taskAffinity}</dt>
370<dd>An affinity name that applies to all activities within the application,
371except for those that set a different affinity with their own
372<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 
373attributes.  See that attribute for more information.
374
375<p>
376By default, all activities within an application share the same 
377affinity.  The name of that affinity is the same as the package name 
378set by the 
379<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
380</p></dd>
381
382<dt><a name="testOnly"></a>{@code android:testOnly}</dt>
383<dd>Indicates whether this application is only for testing purposes. For example,
384it may expose functionality or data outside of itself that would cause a security
385hole, but is useful for testing. This kind of application can be installed
386only through adb.</dd>
387
388
389<dt><a name="theme"></a>{@code android:theme}</dt>
390<dd>A reference to a style resource defining a default theme for all
391activities in the application.  Individual activities can override
392the default by setting their own <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#theme">theme</a></code> 
393attributes. For more information, see the <a
394href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a> developer guide.
395</dd>
396
397<!-- ##api level 14## -->
398<dt><a name="uioptions"></a>{@code android:uiOptions}</dt>
399<dd>Extra options for an activity's UI.
400  <p>Must be one of the following values.</p>
401
402  <table>
403    <tr><th>Value</th><th>Description</th></tr>
404    <tr><td>{@code "none"}</td><td>No extra UI options. This is the default.</td></tr>
405    <tr><td>{@code "splitActionBarWhenNarrow"}</td><td>Add a bar at
406the bottom of the screen to display action items in the {@link android.app.ActionBar}, when
407constrained for horizontal space (such as when in portrait mode on a handset). Instead of a small
408number of action items appearing in the action bar at the top of the screen, the action bar is
409split into the top navigation section and the bottom bar for action items. This ensures a reasonable
410amount of space is made available not only for the action items, but also for navigation and title
411elements at the top. Menu items are not split across the two bars; they always appear
412together.</td></tr>
413  </table>
414  <p>For more information about the action bar, see the <a
415href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide.</p>
416  <p>This attribute was added in API level 14.</p>
417</dd>
418
419<dt><a name="vmSafeMode"></a>{@code android:vmSafeMode}</dt>
420<dd>Indicates whether the app would like the virtual machine (VM) to operate
421in safe mode. The default value is {@code "false"}.
422</dd>
423
424
425
426
427</dl></dd>
428
429<!-- ##api level indication## -->
430<dt>introduced in:</dt>
431<dd>API Level 1</dd>
432
433<dt>see also:</dt>
434<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
435<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
436<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
437<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></dd>
438
439</dl>
440