uses-configuration-element.jd revision 71d4b289a7a934ecd16c3036b812d40db6d3a74d
1page.title=<uses-configuration>
2@jd:body
3
4<!-- ##api level 3##  see comment below -->
5
6<!-- the "no___" values are nonsensical if they mean "doesn't work on devices with a
7keyboard / navigation control / touch screen."  Dianne says that that's what they mean and 
8that they therefore should be eliminated.  Suchi says that they mean "doesn't require a 
9keyboard / navigation control / touch screen to work."  But then what does "undefined" mean?
10Seems like some API change is in the works, either eliminating the "no___" values or
11"undefined".  Since it's unclear what the change will be, I've chosen to document the "no___" 
12and "undefined" attributes using the same language, which is surely wrong but may make it
13easier to update the doc when the change is made. -->
14
15<dl class="xml">
16<dt>syntax:</dt>
17<dd><pre class="stx">&lt;uses-configuration android:<a href="#five">reqFiveWayNav</a>=["true" | "false"] 
18                    android:<a href="#hard">reqHardKeyboard</a>=["true" | "false"]
19                    android:<a href="#kbd">reqKeyboardType</a>=["undefined" | "nokeys" | "qwerty" |  
20                                             "twelvekey"]
21                    android:<a href="#nav">reqNavigation</a>=["undefined" | "nonav" | "dpad" | 
22                                           "trackball" | "wheel"]
23                    android:<a href="#touch">reqTouchScreen</a>=["undefined" | "notouch" | "stylus" | 
24                                            "finger"] /&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>description:</dt>
30<dd>Indicates what hardware and software features the application requires.  
31For example, an application might specify that it requires a physical keyboard 
32or a particular navigation device, like a trackball.  The specification is
33used to avoid installing the application on devices where it will not work.
34
35<p>
36If an application can work with different device configurations, it 
37should include separate {@code &lt;uses-configuration&gt;} declarations for 
38each one.  Each declaration must be complete.  For example, if an application 
39requires a five-way navigation control, a touch screen that can be operated 
40with a finger, and either a standard QWERTY keyboard or a numeric 12-key
41keypad like those found on most phones, it would specify these requirements
42with two {@code &lt;uses-configuration&gt;} elements as follows:
43</p>
44
45<pre>&lt;uses-configuration android:reqFiveWayNav="true" android:reqTouchScreen="finger"
46                    android:reqKeyboardType="qwerty" /&gt;
47&lt;uses-configuration android:reqFiveWayNav="true" android:reqTouchScreen="finger"
48                    android:reqKeyboardType="twelvekey" /&gt;</pre></dd>
49
50<dt>attributes:</dt>
51<dd><dl class="attr">
52<dt><a name="five"></a>{@code android:reqFiveWayNav}</dt>
53<dd>Whether or not the application requires a five-way navigation control 
54&mdash; "{@code true}" if it does, and "{@code false}" if not.  A five-way
55control is one that can move the selection up, down, right, or left, and 
56also provides a way of invoking the current selection.  It could be a 
57D-pad (directional pad), trackball, or other device.  
58
59<p>
60If an application requires a directional control, but not a control of a
61particular type, it can set this attribute to "{@code true}" and ignore 
62the <code><a href="#nav">reqNavigation</a></code> attribute.  However,
63if it requires a particular type of directional control, it can ignore
64this attribute and set {@code reqNavigation} instead.
65</p></dd>
66
67<dt><a name="hard"></a>{@code android:reqHardKeyboard}</dt>
68<dd>Whether or not the application requires a hardware keyboard &mdash;
69"{@code true}" if it does, and "{@code false}" if not.</dd>
70
71<dt><a name="kbd"></a>{@code android:reqKeyboardType}</dt>
72<dd>The type of keyboard the application requires, if any at all. 
73This attribute does not distinguish between hardware and software 
74keyboards.  If a hardware keyboard of a certain type is required,
75specify the type here and also set the {@code reqHardKeyboard} attribute 
76to "{@code true}".
77
78<p>
79The value must be one of the following strings:
80</p>
81
82<table>
83<tr>
84   <th>Value</th>
85   <th>Description</th>
86</tr><tr>
87   <td>"{@code undefined}"</td>
88   <td>The application does not require a keyboard. 
89       (A keyboard requirement is not defined.)  
90       This is the default value.</td>
91</tr><tr>
92   <td>"{@code nokeys}"</td>
93   <td>The application does not require a keyboard.</td>
94</tr><tr>
95   <td>"{@code qwerty}"</td>
96   <td>The application requires a standard QWERTY keyboard.</td>
97</tr><tr>
98   <td>"{@code twelvekey}"</td>
99   <td>The application requires a twelve-key keypad, like those on most 
100       phones &mdash; with keys for the digits from {@code 0} through 
101       {@code 9} plus star ({@code *}) and pound ({@code #}) keys.</td>
102</tr>
103</table></dd>
104
105<dt><a name="nav"></a>{@code android:reqNavigation}</dt>
106<dd>The navigation device required by the application, if any.  The value 
107must be one of the following strings:
108
109<table>
110<tr>
111   <th>Value</th>
112   <th>Description</th>
113</tr><tr>
114   <td>"{@code undefined}"</td>
115   <td>The application does not require any type of navigation control. 
116       (The navigation requirement is not defined.)  
117       This is the default value.</td>
118</tr><tr>
119   <td>"{@code nonav}"</td>
120   <td>The application does not require a navigation control.</td>
121</tr><tr>
122   <td>"{@code dpad}"</td>
123   <td>The application requires a D-pad (directional pad) for navigation.</td>
124</tr><tr>
125   <td>"{@code trackball}"</td>
126   <td>The application requires a trackball for navigation.</td>
127</tr><tr>
128   <td>"{@code wheel}"</td>
129   <td>The application requires a navigation wheel.</td>
130</tr>
131</table>
132
133<p>
134If an application requires a navigational control, but the exact type of
135control doesn't matter, it can set the 
136<code><a href="#five">reqFiveWayNav</a></code> attribute to "{@code true}"
137rather than set this one.
138</p></dd>
139
140<dt><a name="touch"></a>{@code android:reqTouchScreen}</dt>
141<dd>The type of touch screen the application requires, if any at all.
142The value must be one of the following strings: 
143
144<table>
145<tr>
146   <th>Value</th>
147   <th>Description</th>
148</tr><tr>
149   <td>"{@code undefined}"</td>
150   <td>The application doesn't require a touch screen.  
151       (The touch screen requirement is undefined.)
152       This is the default value.</td>
153</tr><tr>
154   <td>"{@code notouch}"</td>
155   <td>The application doesn't require a touch screen.</td>
156</tr><tr>
157   <td>"{@code stylus}"</td>
158   <td>The application requires a touch screen that's operated with a stylus.</td>
159</tr><tr>
160   <td>"{@code finger}"</td>
161   <td>The application requires a touch screen that can be operated with a finger.</td>
162</tr>
163</table></dd>
164</dl></dd>
165
166<!-- ##api level 3## -->
167<dt>introduced in:</dt>
168<dd>API Level 3</dd>
169
170<dt>see also:</dt>
171<dd>
172  <ul>
173    <li><code><a href="{@docRoot}guide/topics/manifest/activity-element.html#config">configChanges</a></code>
174attribute of the
175<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
176element</dd></li>
177    <li>{@link android.content.pm.ConfigurationInfo}</li>
178  </ul>
179</dd>
180
181</dl>
182