application-element.jd revision 6e88c84cbe0a07cb8c7b9ea23d1434bcf2e2a457
1page.title=<application>
2@jd:body
3
4<dl class="xml">
5<dt>syntax:</dt>
6<dd><pre class="stx">&lt;application android:<a href="#reparent">allowTaskReparenting</a>=["true" | "false"]
7             android:<a href="#agent">backupAgent</a>="<i>string</i>"
8             android:<a href="#debug">debuggable</a>=["true" | "false"]
9             android:<a href="#desc">description</a>="<i>string resource</i>"
10             android:<a href="#enabled">enabled</a>=["true" | "false"]
11             android:<a href="#code">hasCode</a>=["true" | "false"]
12             android:<a href="#icon">icon</a>="<i>drawable resource</i>"
13             android:<a href="#killrst">killAfterRestore</a>=["true" | "false"]
14             android:<a href="#label">label</a>="<i>string resource</i>"
15             android:<a href="#space">manageSpaceActivity</a>="<i>string</i>"
16             android:<a href="#nm">name</a>="<i>string</i>"
17             android:<a href="#prmsn">permission</a>="<i>string</i>"
18             android:<a href="#persistent">persistent</a>=["true" | "false"]
19             android:<a href="#proc">process</a>="<i>string</i>"
20             android:<a href="#restoreany">restoreAnyVersion</a>=["true" | "false"]
21             android:<a href="#aff">taskAffinity</a>="<i>string</i>"
22             android:<a href="#theme">theme</a>="<i>resource or theme</i>" &gt;
23    . . .
24&lt;/application&gt;</pre></dd>
25
26<dt>contained in:</dt>
27<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
28
29<dt>can contain:</dt>
30<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
31<br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
32<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
33<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
34<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>
35<br/><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code></dd>
36
37<dt>description:</dt>
38<dd>The declaration of the application.  This element contains subelements 
39that declare each of the application's components and has attributes 
40that can affect all the components.  Many of these attributes (such as 
41{@code icon}, {@code label}, {@code permission}, {@code process}, 
42{@code taskAffinity}, and {@code allowTaskReparenting}) set default values 
43for corresponding attributes of the component elements.  Others (such as
44{@code debuggable}, {@code enabled}, {@code description}, and 
45{@code allowClearUserData})  set values for the application as a whole and 
46cannot be overridden by the components.</dd>
47
48<dt>attributes</dt>
49<dd><dl class="attr">
50
51<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
52<dd>Whether or not activities that the application defines can move from 
53the task that started them to the task they have an affinity for when that task 
54is next brought to the front &mdash; "{@code true}" if they can move, and 
55"{@code false}" if they must remain with the task where they started.  
56The default value is "{@code false}".
57
58<p>
59The 
60<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
61element has its own 
62<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code>
63attribute that can override the value set here.  See that attribute for more 
64information.
65</p></dd>
66
67<dt><a name="agent"></a>{@code android:backupAgent}</dt>
68<dd>The name of the class that implement's the application's backup agent,
69a subclass of {@link android.app.backup.BackupAgent}.  The attribute value should be
70a fully qualified  class name (such as, "{@code com.example.project.MyBackupAgent}").  
71However, as a shorthand, if the first character of the name is a period 
72(for example, "{@code .MyBackupAgent}"), it is appended to the 
73package name specified in the 
74<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
75element.
76
77<p>
78There is no default.  The name must be specified.
79</p></dd>
80
81<dt><a name="debug"></a>{@code android:debuggable}</dt>
82<dd>Whether or not the application can be debugged, even when running 
83on a device in user mode &mdash; "{@code true}" if it can be, and "{@code false}"
84if not.  The default value is "{@code false}".</dd> 
85
86<dt><a name="desc"></a>{@code android:description}</dt>
87<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>
88
89<dt><a name="enabled"></a>{@code android:enabled}</dt>
90<dd>Whether or not the Android system can instantiate components of 
91the application &mdash; "{@code true}" if it can, and "{@code false}" 
92if not.  If the value is "{@code true}", each component's 
93{@code enabled} attribute determines whether that component is enabled 
94or not.  If the value is "{@code false}", it overrides the 
95component-specific values; all components are disabled.
96
97<p>
98The default value is "{@code true}".
99</p></dd>  
100
101<dt><a name="code"></a>{@code android:hasCode}</dt>
102<dd>Whether or not the application contains any code &mdash; "{@code true}" 
103if it does, and "{@code false}" if not.  When the value is "{@code false}", 
104the system does not try to load any application code when launching components.  
105The default value is "{@code true}".
106
107<p>
108An application would not have any code of its own only if it's using nothing
109but built-in component classes, such as an activity that uses the {@link 
110android.app.AliasActivity} class, a rare occurrence.
111
112<dt><a name="icon"></a>{@code android:icon}</dt>
113<dd>An icon for the application as whole, and the default icon for 
114each of the application's components.  See the individual 
115{@code icon} attributes for 
116<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
117<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
118<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
119<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
120<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
121
122<p>
123This attribute must be set as a reference to a drawable resource containing
124the image definition.   There is no default icon.
125</p></dd>
126
127<dt><a name="killrst"></a>{@code android:killAfterRestore}</dt>
128<dd>Whether the application in question should be terminated after its
129settings have been restored during a full-system restore operation.
130Single-package restore operations will never cause the application to
131be shut down.  Full-system restore operations typically only occur once,
132when the phone is first set up.  Third-party applications will not normally
133need to use this attribute.
134
135<p>The default is {@code true}, which means that after the application
136has finished processing its data during a full-system restore, it will be
137terminated.
138</p></dd>
139
140<dt><a name="label"></a>{@code android:label}</dt>
141<dd>A user-readable label for the application as a whole, and a default 
142label for each of the application's components.  See the individual 
143{@code label} attributes for 
144<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
145<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
146<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
147<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
148<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
149
150<p>
151The label should be set as a reference to a string resource, so that
152it can be localized like other strings in the user interface.  
153However, as a convenience while you're developing the application, 
154it can also be set as a raw string.
155</p></dd>
156
157<dt><a name="space"></a>{@code android:manageSpaceActivity}</dt>
158<dd>The fully qualified name of an Activity subclass that the system 
159can launch to let users manage the memory occupied by the application 
160on the device.  The activity should also be declared with an 
161<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element.
162</dd>
163
164<dt><a name="nm"></a>{@code android:name}</dt>
165<dd>The fully qualified name of an {@link android.app.Application} 
166subclass implemented for the application.  When the application process 
167is started, this class is instantiated before any of the application's 
168components.  
169
170<p>
171The subclass is optional; most applications won't need one.
172In the absence of a subclass, Android uses an instance of the base 
173Application class.
174</p></dd>
175
176<dt><a name="prmsn"></a>{@code android:permission}</dt>
177<dd>The name of a permission that clients must have in order to interact 
178with the application.  This attribute is a convenient way to set a 
179permission that applies to all of the application's components.  It can 
180be overwritten by setting the {@code permission} attributes of individual 
181components.
182
183<p>
184For more information on permissions, see the 
185<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a> 
186section in the introduction and another document, 
187<a href="{@docRoot}guide/topics/security/security.html">Security and
188Permissions</a>.
189</p></dd>
190
191<dt><a name="persistent"></a>{@code android:persistent}</dt>
192<dd>Whether or not the application should remain running at all times &mdash; 
193"{@code true}" if it should, and "{@code false}" if not.  The default value 
194is "{@code false}".  Applications should not normally set this flag; 
195persistence mode is intended only for certain system applications.</dd>
196
197<dt><a name="proc"></a>{@code android:process}</dt>
198<dd>The name of a process where all components of the application should run.
199Each component can override this default by setting its own {@code process}
200attribute.
201
202<p>
203By default, Android creates a process for an application when the first
204of its components needs to run.  All components then run in that process.
205The name of the default process matches the package name set by the
206<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
207</p>
208
209<p>By setting this attribute to a process name that's shared with another
210application, you can arrange for components of both applications to run in
211the same process &mdash; but only if the two applications also share a
212user ID and be signed with the same certificate.
213</p>
214
215<p>
216If the name assigned to this attribute begins with a colon (':'), a new 
217process, private to the application, is created when it's needed.
218If the process name begins with a lowercase character, a global process 
219of that name is created.  A global process can be shared with other
220applications, reducing resource usage.
221</p></dd>
222
223<dt><a href name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
224<dd>Indicate that the application is prepared to attempt a restore of any
225backed-up data set, even if the backup was stored by a newer version
226of the application than is currently installed on the device.  Setting
227this attribute to {@code true} will permit the Backup Manager to
228attempt restore even when a version mismatch suggests that the data are
229incompatible.  <em>Use with caution!</em>
230
231<p>The default value of this attribute is {@code false}.
232</p></dd>
233
234<dt><a href name="aff"></a>{@code android:taskAffinity}</dt>
235<dd>An affinity name that applies to all activities within the application,
236except for those that set a different affinity with their own
237<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 
238attributes.  See that attribute for more information.
239
240<p>
241By default, all activities within an application share the same 
242affinity.  The name of that affinity is the same as the package name 
243set by the 
244<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
245</p></dd>
246
247<dt><a name="theme"></a>{@code android:theme}</dt>
248<dd>A reference to a style resource defining a default theme for all
249activities in the application.  Individual activities can override
250the default by setting their own <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#theme">theme</a></code> 
251attributes; see that attribute for more information.</dd>
252
253</dl></dd>
254
255<!-- ##api level indication## -->
256<dt>introduced in:</dt>
257<dd>API Level 1</dd>
258
259<dt>see also:</dt>
260<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
261<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
262<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
263<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></dd>
264
265</dl>
266