1page.title=Android 4.0.3 APIs
2excludeFromSuggestions=true
3sdk.platform.version=4.0.3
4sdk.platform.apiLevel=15
5@jd:body
6
7<div id="qv-wrapper">
8<div id="qv">
9
10<h2>In this document</h2>
11<ol>
12  <li><a href="#api">API Overview</a></li>
13  <li><a href="#Honeycomb">Previous APIs</a></li>
14  <li><a href="#api-level">API Level</a></li>
15</ol>
16
17<h2>Reference</h2>
18<ol>
19<li><a
20href="{@docRoot}sdk/api_diff/15/changes.html">API
21Differences Report &raquo;</a> </li>
22</ol>
23
24</div>
25</div>
26
27<p><em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
28
29<p>Android {@sdkPlatformVersion} ({@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1})
30is an incremental release of the Android 4.x
31(Ice Cream Sandwich) platform family. This release includes new features for
32users and developers, API changes, and various bug fixes.</p>
33
34<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
35downloadable component for the Android SDK. The downloadable platform includes
36an Android library and system image, as well as a set of emulator skins and
37more. To get started developing or testing against Android {@sdkPlatformVersion},
38use the Android SDK Manager to download the platform into your SDK.</p>
39
40
41<h2 id="api">API Overview</h2>
42
43<p>The sections below provide a technical overview of new APIs in Android 4.0.3.</p>
44
45<div class="toggle-content closed">
46
47  <p><a href="#" onclick="return toggleContent(this)">
48    <img src="{@docRoot}assets/images/styles/disclosure_down.png"
49class="toggle-content-img" alt="" /><strong>Table of Contents</strong>
50  </a></p>
51
52  <div class="toggle-content-toggleme" style="padding-left:2em;">
53    <ol class="toc" style="margin-left:-1em">
54      <li><a href="#contacts">Social stream API in Contacts Provider</a></li>
55      <li><a href="#calendar">Calendar Provider</a></li>
56      <li><a href="#widgets">Home screen widgets</a></li>
57      <li><a href="#textservices">Spell-checking</a></li>
58      <li><a href="#bluetooth">Bluetooth</a></li>
59      <li><a href="#ui">UI toolkit</a></li>
60      <li><a href="#accessibility">Accessibility</a></li>
61      <li><a href="#tts">Text-to-speech</a></li>
62      <li><a href="#database">Database</a></li>
63      <li><a href="#intents">Intents</a></li>
64      <li><a href="#camera">Camera</a></li>
65      <li><a href="#permissions">Permissions</a></li>
66    </ol>
67  </div>
68</div>
69
70
71
72
73
74<h3 id="contacts">Social stream API in Contacts Provider</h3>
75
76<p>Applications that use social stream data such as status updates and check-ins
77can now sync that data with each of the user’s contacts, providing items in a
78stream along with photos for each.</p>
79
80<p>The database table that contains an individual contact’s social stream is
81defined by android.provider.ContactsContract.StreamItems, the Uri for
82which is nested within the {@link android.provider.ContactsContract.RawContacts}
83directory to which the stream items belong. Each social stream table includes
84several columns for metadata about each stream item, such as an icon
85representing the source (an avatar), a label for the item, the primary text
86content, comments about the item (such as responses from other people), and
87more. Photos associated with a stream are stored in another table, defined by
88android.provider.ContactsContract.StreamItemPhotos, which is available
89as a sub-directory of the android.provider.ContactsContract.StreamItems
90Uri.</p>
91
92<p>See android.provider.ContactsContract.StreamItems and
93android.provider.ContactsContract.StreamItemPhotos for more information.</p>
94
95<p>To read or write social stream items for a contact, an application must
96request permission from the user by declaring <code>&lt;uses-permission
97android:name="android.permission.READ_SOCIAL_STREAM"&gt;</code> and/or <code>&lt;uses-permission
98android:name="android.permission.WRITE_SOCIAL_STREAM"&gt;</code> in their manifest files.</p>
99
100<h3 id="calendar">Calendar Provider</h4>
101<ul>
102<li>Adds the class {@link android.provider.CalendarContract.Colors} to represent
103a color table in the <a href="{@docRoot}guide/topics/providers/calendar-provider.html">Calendar
104Provider</a>. The class provides fields for accessing
105colors available for a given account. Colors are referenced by
106{@link android.provider.CalendarContract.ColorsColumns#COLOR_KEY COLOR_KEY}
107which must be unique for a given account name/type. These values can only be
108updated by the sync adapter.</li>
109<li>Adds {@link android.provider.CalendarContract.CalendarColumns#ALLOWED_AVAILABILITY ALLOWED_AVAILABILITY}
110and
111{@link android.provider.CalendarContract.CalendarColumns#ALLOWED_ATTENDEE_TYPES ALLOWED_ATTENDEE_TYPES}
112for exchange/sync support.</li>
113<li>Adds {@link android.provider.CalendarContract.AttendeesColumns#TYPE_RESOURCE}
114(such as conference rooms) for attendees and
115{@link android.provider.CalendarContract.EventsColumns#AVAILABILITY_TENTATIVE},
116as well as {@link android.provider.CalendarContract.EventsColumns#EVENT_COLOR_KEY}
117for events.</li>
118</ul>
119
120<h3 id="widgets">Home screen widgets</h3>
121
122<p>Starting from Android 4.0, home screen widgets should no longer include their
123own padding. Instead, the system now automatically adds padding for each widget,
124based the characteristics of the current screen. This leads to a more uniform,
125consistent presentation of widgets in a grid. To assist applications that host
126home screen widgets, the platform provides a new method
127{@link android.appwidget.AppWidgetHostView#getDefaultPaddingForWidget(android.content.Context, android.content.ComponentName, android.graphics.Rect)
128getDefaultPaddingForWidget()}. Applications can call this method to get the
129system-defined padding and account for it when computing the number of cells to
130allocate to the widget.</p>
131
132<h3 id="textservices">Spell-checking</h3>
133
134<ul>
135<li>For apps that accessing spell-checker services, a new {@link
136android.view.textservice.SpellCheckerSession#cancel() cancel()} method cancels
137any pending and running spell-checker tasks in a session.</li>
138
139<li>For spell-checker services, a new suggestions flag,
140{@link android.view.textservice.SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS},
141lets the services distinguish higher-confidence suggestions from
142lower-confidence ones. For example, a spell-checker could set the flag if an
143input word is not in the user dictionary but has likely suggestions, or not set
144the flag if an input word is not in the dictionary and has suggestions that are
145likely to be less useful.
146
147<p>Apps connected to the spell-checker can use the {@link
148android.view.textservice.SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS}
149flag in combination with other suggestion attributes, as well as the {@link
150android.view.textservice.SuggestionsInfo#getSuggestionsAttributes()} and {@link
151android.view.textservice.SuggestionsInfo#getSuggestionsCount()} methods, to
152determine whether to mark input words as typos and offer suggestions.</p></li>
153
154<li>A new {@link android.text.style.SuggestionSpan#FLAG_AUTO_CORRECTION} style
155for text spans indicates that auto correction is about to be applied to a
156word/text that the user is typing/composing. This type of suggestion is rendered
157differently, to indicate the auto correction is happening.</li>
158</ul>
159
160<h3 id="bluetooth">Bluetooth</h3>
161<p>New public methods {@link
162android.bluetooth.BluetoothDevice#fetchUuidsWithSdp()} and {@link
163android.bluetooth.BluetoothDevice#getUuids()} let apps determine the features
164(UUIDs) supported by a remote device. In the case of {@link
165android.bluetooth.BluetoothDevice#fetchUuidsWithSdp()}, the system performs a
166service discovery on the remote device to get the UUIDs supported, then
167broadcasts the result in an {@link
168android.bluetooth.BluetoothDevice#ACTION_UUID} intent.</p>
169
170<h3 id="ui">UI toolkit</h3>
171
172<p>New methods {@link android.app.Fragment#setUserVisibleHint(boolean) setUserVisibleHint()} and
173{@link android.app.Fragment#getUserVisibleHint() getUserVisibleHint()} allow a
174fragment to set a hint of whether or not it is currently user-visible. The
175system defers the start of fragments that are not user-visible until the loaders
176for visible fragments have run. The visibility hint is "true" by default.</li>
177</p>
178
179<h3 id="graphics">Graphics</h3>
180
181<ul>
182<li>New method {@link android.graphics.SurfaceTexture#setDefaultBufferSize(int
183width, int height)} in {@link android.graphics.SurfaceTexture} sets the default size of the image
184buffers. This method may be used to set the image size when producing images
185with {@link android.graphics.Canvas} (via {@link
186android.view.Surface#lockCanvas}), or OpenGL ES (via an EGLSurface).</li>
187<li>Adds definitions for the enums of the GL_OES_EGL_image_external OpenGL ES extension &mdash;
188{@link android.opengl.GLES11Ext#GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES},
189{@link android.opengl.GLES11Ext#GL_SAMPLER_EXTERNAL_OES},
190{@link android.opengl.GLES11Ext#GL_TEXTURE_BINDING_EXTERNAL_OES}, and
191{@link android.opengl.GLES11Ext#GL_TEXTURE_EXTERNAL_OES}.</li>
192</ul>
193
194<h3 id="accessibility">Accessibility</h3>
195
196<ul>
197<li>Clients of {@link android.widget.RemoteViews} can now use the method {@link
198android.widget.RemoteViews#setContentDescription(int, java.lang.CharSequence)
199setContentDescription()} to set and get the content description of any View in
200the inflated layout.</li>
201
202<li>The methods {@link android.view.accessibility.AccessibilityRecord#getMaxScrollX()},
203{@link android.view.accessibility.AccessibilityRecord#getMaxScrollY()},
204{@link android.view.accessibility.AccessibilityRecord#setMaxScrollX(int) setMaxScrollX()}, and
205{@link android.view.accessibility.AccessibilityRecord#setMaxScrollY(int) setMaxScrollY()}
206allow apps to get and set the maximum scroll offset for an
207{@link android.view.accessibility.AccessibilityRecord} object.</li>
208
209<li>When touch-exploration mode is enabled, a new secure setting
210{@link android.provider.Settings.Secure#ACCESSIBILITY_SPEAK_PASSWORD}
211indicates whether the user requests the IME to speak text entered in password fields, even when
212a headset is not in use. By default, no password text is spoken unless a headset
213is in use.</li>
214</ul>
215
216<h3 id="tts">Text-to-speech</h3>
217
218<ul>
219<li>Adds the new method {@link
220android.speech.tts.TextToSpeech.Engine#getFeatures(java.util.Locale)
221getFeatures()}for querying and enabling network TTS support.
222<li>Adds a new listener class, {@link
223android.speech.tts.UtteranceProgressListener}, that engines can register to
224receive notification of speech-synthesis errors.</li>
225</ul>
226
227<h3 id="database">Database</h3>
228
229<ul>
230<li>A new {@link android.database.CrossProcessCursorWrapper} class lets content
231providers return results for a cross-process query more efficiently. The new
232class is a useful building block for wrapping cursors that will be sent to
233processes remotely. It can also transform normal {@link android.database.Cursor}
234objects into {@link android.database.CrossProcessCursor} objects
235transparently.
236
237<p>The {@link android.database.CrossProcessCursorWrapper} class fixes common
238performance issues and bugs that applications have encountered when
239implementing content providers.</p></li>
240
241<li>The {@link android.database.CursorWindow#CursorWindow(java.lang.String)}
242constructor now takes a name string as input. The system no longer distinguishes
243between local and remote cursor windows, so {@link
244android.database.CursorWindow#CursorWindow(boolean)} is now deprecated.</li>
245</ul>
246
247<h3 id="intents">Intents</h3>
248
249<p>Adds new categories for targeting common types of applications on the
250device, such as {@link android.content.Intent#CATEGORY_APP_BROWSER}, {@link
251android.content.Intent#CATEGORY_APP_CALENDAR}, {@link
252android.content.Intent#CATEGORY_APP_MAPS}, and more.</li>
253
254<h3 id="camera">Camera</h3>
255
256<ul>
257<li>{@link android.media.MediaMetadataRetriever} adds the new constant
258{@link android.media.MediaMetadataRetriever#METADATA_KEY_LOCATION} to let apps
259access retrieve location information for an image or video. </li>
260
261<li>{@link android.media.CamcorderProfile} adds the QVGA (320x240) resolution
262profiles. Quality level is represented by the
263{@link android.media.CamcorderProfile#QUALITY_QVGA}.and
264{@link android.media.CamcorderProfile#QUALITY_TIME_LAPSE_QVGA} constants.</li>
265
266<li>New methods {@link android.hardware.Camera.Parameters#setVideoStabilization(boolean) setVideoStabilization()},
267{@link android.hardware.Camera.Parameters#getVideoStabilization() getVideoStabilization()}, and {@link android.hardware.Camera.Parameters#isVideoStabilizationSupported() isVideoStabilizationSupported()}
268let you check and manage video stabilization for a {@link android.hardware.Camera}.</li>
269</ul>
270
271<h3 id="Permissions">Permissions</h3>
272
273<p>The following are new permissions:</p>
274<ul>
275<li>android.Manifest.permission#READ_SOCIAL_STREAM and
276android.Manifest.permission#WRITE_SOCIAL_STREAM: Allow a sync
277adapter to read and write social stream data to a contact in the shared
278Contacts Provider.</li>
279</ul>
280
281
282<div class="special" style="margin-top:2em">
283<p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API Level
284{@sdkPlatformApiLevel}), see the <a
285href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API Differences Report</a>.</p>
286</div>
287
288
289<h2 id="api-level">API Level</h2>
290
291<p>The Android {@sdkPlatformVersion} API is assigned an integer
292identifier&mdash;<strong>{@sdkPlatformApiLevel}</strong>&mdash;that is stored in the system itself.
293This identifier, called the "API level", allows the system to correctly determine whether an
294application is compatible with the system, prior to installing the application. </p>
295
296<p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, you need compile the
297application against an Android platform that supports API level {@sdkPlatformApiLevel} or
298higher. Depending on your needs, you might also need to add an
299<code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> attribute to the
300<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>
301element.</p>
302
303<p>For more information, see the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a>
304document. </p>
305
306