• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Android 2.3 APIs
2sdk.platform.version=2.3
3sdk.platform.apiLevel=9
4
5
6@jd:body
7
8<div id="qv-wrapper">
9<div id="qv">
10
11<h2>In this document</h2>
12<ol>
13  <li><a href="#api">API Overview</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/{@sdkPlatformApiLevel}/changes.html">API
21Differences Report &raquo;</a> </li>
22</ol>
23
24</div>
25</div>
26
27<p>
28<em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
29
30<p>For developers, the Android {@sdkPlatformVersion}
31({@link android.os.Build.VERSION_CODES#GINGERBREAD})platform is available as a
32downloadable component for the Android SDK. The downloadable platform includes
33an Android library and system image, as well as a set of emulator skins and
34more. To get started developing or testing against Android {@sdkPlatformVersion},
35use the Android SDK Manager to download the platform into your SDK.</p>
36
37
38
39
40<h2 id="api">API Overview</h2>
41
42<p>The sections below provide a technical overview of what's new for developers
43in {@sdkPlatformVersion}, including new features and changes in the framework
44API since the previous version.</p>
45
46
47<h3 id="sip">SIP-based VoIP</h3>
48
49<p>The platform now includes a SIP protocol stack and framework API that lets
50developers build internet telephony applications. Using the API, applications can offer
51voice calling features without having to manage sessions, transport-level
52communication, or audio &mdash; these are handled
53transparently by the platform's SIP API and services.</p>
54
55<p>The SIP API is available in the {@link android.net.sip android.net.sip}
56package. The key class is {@link android.net.sip.SipManager}, which applications
57use to set up and manage SIP profiles, then initiate audio calls and receive
58audio calls. Once an audio call is established, applications can mute calls,
59turn on speaker mode, send DTMF tones, and more. Applications can also use the
60{@link android.net.sip.SipManager} to create generic SIP connections.</p>
61
62<p>The platform’s underlying SIP stack and services are available on devices at
63the discretion of the manufacturer and associated carrier. For this reason,
64applications should use the  {@link android.net.sip.SipManager#isApiSupported
65isApiSupported()} method to check whether SIP support is available, before
66exposing calling functionality to users. </p>
67
68<p>To use the SIP API, applications must request permission from the user by
69declaring <code>&lt;uses-permission
70android:name="android.permission.INTERNET"&gt;</code> and <code>&lt;uses-permission
71android:name="android.permission.USE_SIP"&gt;</code> in their manifest files.</p>
72
73<p>Additionally, developers can request filtering on Google Play, such that
74their applications are not discoverable to users whose devices do not include
75the platform’s SIP stack and services. To request filtering, add <code>&lt;uses-feature
76android:name="android.software.sip"
77android:required="true"&gt;</code> and <code>&lt;uses-feature
78android:name="android.software.sip.voip"&gt;</code> to the application manifest.</p>
79
80<p class="note">For more information, read the <a
81href="{@docRoot}guide/topics/connectivity/sip.html">SIP</a> developer guide.</p>
82
83<h3 id="nfc">Near Field Communications (NFC)</h3>
84
85<p>Android 2.3 includes an NFC stack and framework API that lets developers
86read NDEF tags that are discovered as a user touches an NFC-enabled device
87to tag elements embedded in stickers, smart posters, and even other devices.</p>
88
89<p>The platform provides the underlying NFC services that work with the device
90hardware to discover tags when they come into range. On discovering a tag, the
91platform notifies applications by broadcasting an Intent, appending the tag's
92NDEF messages to the Intent as extras. Applications can create Intent filters to
93recognize and handle targeted tags and messages. For example, after receiving a
94tag by Intent, applications extract the NDEF messages, store them, alert the
95user, or handle them in other ways. </p>
96
97<p>The NFC API is available in the {@link android.nfc} package. The key classes are: </p>
98
99<ul><li>{@link android.nfc.NfcAdapter}, which represents the NFC hardware on the device.</li>
100<li>{@link android.nfc.NdefMessage}, which represents an NDEF data message,
101the standard format in which "records" carrying data are transmitted between
102devices and tags. Applications can receive these messages from {@link
103android.nfc.NfcAdapter#ACTION_TAG_DISCOVERED}</code> Intents.</li>
104<li>{@link android.nfc.NdefRecord}, delivered in an
105{@link android.nfc.NdefMessage}, which describes the type of data being shared and
106carries the data itself.</li>
107</ul>
108
109<p>NFC communication relies on wireless technology in the device hardware, so
110support for the platform's NFC features on specific devices is determined by
111their manufacturers. To determine the NFC support on the current device,
112applications can call {@link android.nfc.NfcAdapter#isEnabled isEnabled()} to
113query the {@link android.nfc.NfcAdapter}. The NFC API is always present,
114however, regardless of underlying hardware support.</p>
115
116<p>To use the NFC API, applications must request permission from the user by
117declaring <code>&lt;uses-permission
118android:name="android.permission.NFC"&gt;</code> in their manifest files.</p>
119
120<p>Additionally, developers can request filtering on Google Play, such that
121their applications are not discoverable to users whose devices do not support
122NFC. To request filtering, add
123<code>&lt;uses-feature android:name="android.hardware.nfc"
124android:required="true"&gt;</code> to the application's manifest.</p>
125
126<p class="note">To look at a sample application that uses the NFC API, see
127<a href="{@docRoot}resources/samples/NFCDemo/index.html">NFCDemo</a>.</p>
128
129<h3 id="sensors">Gyroscope and other sensors</h3>
130
131<p>Android 2.3 adds platform and API support for several new sensor reading
132types &mdash; gyroscope, rotation vector, linear acceleration, gravity, and barometer.
133Developers can use the new sensor readings to create applications that respond
134quickly and smoothly to precise changes in device position and motion. The
135Sensor API reports gyroscope and other sensor changes to interested
136applications, whether they are running on the application framework or in native
137code. </p>
138
139<p>Note that the specific set of hardware sensors available on any given device
140varies at the discretion of the device manufacturer. </p>
141
142<p>Developers can request filtering on Google Play, such that their
143applications are not discoverable to users whose devices do not offer a
144gyroscope sensor. To do so, add <code>&lt;uses-feature
145android:name="android.hardware.sensor.gyroscope"
146android:required="true"&gt;</code> to the application manifest.</p>
147
148<p>For API details, see {@link android.hardware.Sensor}.</p>
149
150
151<h3 id="cameras">Multiple cameras support</h3>
152
153<p>Applications can now make use of any cameras that are available on a device,
154for either photo or video capture. The {@link android.hardware.Camera} lets
155applications query for the number of cameras available and the unique
156characteristics of each. </p>
157
158<ul>
159<li>New {@link android.hardware.Camera.CameraInfo} class stores a camera's
160positional characteristics (orientation, front-facing or back-facing).</li>
161<li>New {@link android.hardware.Camera#getNumberOfCameras()} and {@link
162android.hardware.Camera#getCameraInfo(int,CameraInfo) getCameraInfo()} methods in the {@link
163android.hardware.Camera} class let applications query for the cameras available
164and open the camera that they need.</li>
165<li>New {@link android.media.CamcorderProfile#get get()} method lets
166applications retrieve a {@link android.media.CamcorderProfile} for a specific camera. </li>
167<li>New {@link android.media.CameraProfile#getJpegEncodingQualityParameter(int, int)
168getJpegEncodingQualityParameter()} lets applications obtain the still-image
169capture quality level for a specific camera.</li>
170</ul>
171
172<p class="note">To look at sample code for accessing a front-facing camera, see <a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html">CameraPreview.java</a>
173in the ApiDemos sample application.</p>
174
175<p>The Camera API also adds: </p>
176<ul>
177<li>New parameters for cameras, including focus distance, focus mode, and
178preview fps maximum/minimum. New {@link
179android.hardware.Camera.Parameters#getFocusDistances(float[])
180getFocusDistances()}, {@link
181android.hardware.Camera.Parameters#getPreviewFpsRange(int[])
182getPreviewFpsRange()}, and {@link
183android.hardware.Camera.Parameters#getSupportedPreviewFpsRange()
184getSupportedPreviewFpsRange()} for getting camera parameters, as well as {@link
185android.hardware.Camera.Parameters#setPreviewFpsRange(int, int)
186setPreviewFpsRange()} for setting preview framerate. </li>
187</ul>
188
189<h3 id="media">Mixable audio effects</h3>
190
191<p>The platform's media framework adds support for new per-track or global audio effects,
192including bass boost, headphone virtualization, equalization, and reverb.</p>
193<ul>
194<li>New {@link android.media.audiofx android.media.audiofx} package provides the
195API to access audio effects.</li>
196<li>New {@link android.media.audiofx.AudioEffect AudioEffect} is the  base class
197for controlling audio effects provided by the Android audio framework.
198<li>New audio session ID that lets an application associate a set of audio
199effects with an instance of {@link android.media.AudioTrack} or {@link
200android.media.MediaPlayer}.</li>
201<li>New {@link android.media.AudioTrack#AudioTrack(int, int, int, int, int, int,
202int) AudioTrack} class constructor that lets you create an {@link
203android.media.AudioTrack} with a specific session ID. New {@link
204android.media.AudioTrack#attachAuxEffect(int) attachAuxEffect()}, {@link
205android.media.AudioTrack#getAudioSessionId() getAudioSessionId()}, and {@link
206android.media.AudioTrack#setAuxEffectSendLevel(float) setAuxEffectSendLevel()}
207methods.</li>
208<li>New {@link android.media.MediaPlayer#attachAuxEffect(int)
209attachAuxEffect()}, {@link android.media.MediaPlayer#getAudioSessionId()
210getAudioSessionId()}, {@link android.media.MediaPlayer#setAudioSessionId(int)
211setAudioSessionId(int)}, and {@link
212android.media.MediaPlayer#setAuxEffectSendLevel(float) setAuxEffectSendLevel()}
213methods and supporting types.</li>
214</ul>
215
216<p class="note">To look at sample code for audio effects, see
217<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/media/AudioFxDemo.html">AudioFxDemo.java</a>
218in the ApiDemos sample application.</p>
219
220<p>The media framework also adds:</p>
221<ul>
222<li>New support for altitude tag in EXIF metadata for JPEG files. New method
223{@link android.media.ExifInterface#getAltitude(double) getAltitude()} method to
224retrieve the value of the EXIF altitude tag.</li>
225<li>New {@link android.media.MediaRecorder#setOrientationHint(int)
226setOrientationHint()} method lets an application tell {@link
227android.media.MediaRecorder} of the orientation during video capture.</li>
228</ul>
229
230<h3 id="download">Download manager</h3>
231
232<p>The platform includes a new {@link android.app.DownloadManager} system service
233that handles long-running HTTP downloads. Applications can request that a URI be
234downloaded to a particular destination file. The <code>DownloadManager</code>
235will conduct the download in the background, taking care of HTTP interactions
236and retrying downloads after failures or across connectivity changes and system
237reboots. </p>
238<ul>
239<li>Applications can obtain an instance of the {@link android.app.DownloadManager}
240class by calling {@link
241android.content.Context#getSystemService(String)} and passing
242{@link android.content.Context#DOWNLOAD_SERVICE}. Applications that request
243downloads through this API should register a broadcast receiver for {@link
244android.app.DownloadManager#ACTION_NOTIFICATION_CLICKED}, to appropriately
245handle when the user clicks on a running download in a notification or from the
246Downloads UI.</li>
247<li>The {@link android.app.DownloadManager.Request} class lets an
248application provide all the information necessary to request a new download,
249such as request URI and download destination. A request URI is the only required
250parameter. Note that the default download destination is a shared volume where
251the system can delete your file if it needs to reclaim space for system use. For
252persistent storage of a download, specify a download destination on external
253storage (see {@link
254android.app.DownloadManager.Request#setDestinationUri(Uri)}).</li>
255<li>The {@link android.app.DownloadManager.Query} class provides methods that let
256an application query for and filter active downloads.</li>
257</ul>
258
259<h3 id="strictmode">StrictMode</h3>
260
261<p>To help developers monitor and improve the performance of their applications,
262the platform offers a new system facility called {@link android.os.StrictMode}.
263When implemented in an application, StrictMode catches and notifies the
264developer of accidental disk or network activity that could degrade application
265performance, such as activity taking place on the application's main thread
266(where UI operations are received and animations are also taking place).
267Developers can evaluate the network and disk usages issues raised in StrictMode
268and correct them if needed, keeping the main thread more responsive and
269preventing ANR dialogs from being shown to users.
270
271<ul>
272<li>{@link android.os.StrictMode} is the core class and is the main integration
273point with the system and VM. The class provides convenience methods for
274managing the thread and VM policies that apply to the instance.</li>
275<li>{@link android.os.StrictMode.ThreadPolicy} and {@link
276android.os.StrictMode.VmPolicy} hold the policies that you define and apply to
277thread and VM instances.</li>
278</ul>
279
280<p>For more information about how to use StrictMode to optimize your
281application, see the class documentation and sample code at {@link
282android.os.StrictMode android.os.StrictMode}.</p>
283
284<h3 id="ui">UI Framework</h3>
285
286<ul>
287<li>Support for overscroll
288<ul>
289<li>New support for overscroll in Views and Widgets. In Views, applications can
290enable/disable overscroll for a given view, set the overscoll mode, control the
291overscroll distance, and handle the results of overscrolling. </li>
292<li>In Widgets, applications can control overscroll characteristics such as
293animation, springback, and overscroll distance. For more information, see {@link
294android.view.View android.view.View} and {@link android.widget.OverScroller
295android.widget.OverScroller}. </li>
296<li>{@link android.view.ViewConfiguration} also provides methods {@link
297android.view.ViewConfiguration#getScaledOverflingDistance()} and {@link
298android.view.ViewConfiguration#getScaledOverscrollDistance()}.</li>
299<li>New <code>overScrollMode</code>, <code>overScrollFooter</code>, and
300<code>overScrollHeader</code> attributes for <code>&lt;ListView&gt;</code> elements,
301for controlling overscroll behavior.</li>
302</ul>
303</li>
304
305<li>Support for touch filtering
306<ul>
307<li>New support for touch filtering, which lets an application improve the
308security of Views that provide access to sensitive functionality. For example,
309touch filtering is appropriate to ensure the security of user actions such as
310granting a permission request, making a purchase, or clicking on an
311advertisement. For details, see the <a
312href="{@docRoot}reference/android/view/View.html#Security">View class
313documentation</a>.</li>
314<li>New <code>filterTouchesWhenObscured</code> attribute for view elements,
315which declares whether to filter touches when the view's window is obscured by
316another visible window. When set to <code>"true"</code>, the view will not
317receive touches whenever a toast, dialog or other window appears above the
318view's window. Refer to <a
319href="{@docRoot}reference/android/view/View.html#Security">View security
320documentation</a> for details.</li>
321</ul>
322
323<p class="note">To look at sample code for touch filtering, see
324<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SecureView.html">SecureView.java</a>
325in the ApiDemos sample application.</p>
326</li>
327
328<li>Improved event management
329<ul>
330<li>New base class for input events, {@link android.view.InputEvent}. The class
331provides methods that let applications determine the meaning of the event, such
332as by querying for the InputDevice from which the event orginated. The {@link
333android.view.KeyEvent} and {@link android.view.MotionEvent} are subclasses of
334{@link android.view.InputEvent}.</li>
335<li>New base class for input devices, {@link android.view.InputDevice}. The
336class stores information about the capabilities of a particular input device and
337provides methods that let applications determine how to interpret events from an
338input device.</li>
339</ul>
340</li>
341
342<li>Improved motion events
343<ul>
344<li>The {@link android.view.MotionEvent} API is extended to include "pointer ID"
345information, which lets applications to keep track of individual fingers as they
346move up and down. The class adds a variety of methods that let an application
347work efficiently with motion events.</li>
348<li>The input system now has logic to generate motion events with the new
349pointer ID information, synthesizing identifiers as new pointers are down. The
350system tracks multiple pointer IDs separately during a motion event, and
351ensures proper continuity of pointers by evaluating at the distance
352between the last and next set of pointers.</li>
353</ul>
354</li>
355
356<li>Text selection controls
357<ul>
358<li>A new <code>setComposingRegion</code> method lets an application mark a
359region of text as composing text, maintaining the current styling. A
360<code>getSelectedText</code> method returns the selected text to the
361application. The methods are available in {@link
362android.view.inputmethod.BaseInputConnection}, {@link
363android.view.inputmethod.InputConnection}, and {@link
364android.view.inputmethod.InputConnectionWrapper}.</li>
365<li>New <code>textSelectHandle</code>, <code>textSelectHandleLeft</code>,
366<code>textSelectHandleRight</code>, and <code>textSelectHandleWindowStyle</code>
367attributes for <code>&lt;TextView&gt;</code>, for referencing drawables that will be
368used to display text-selection anchors and the style for the containing
369window.</li>
370</ul>
371</li>
372
373<li>Activity controls
374<ul>
375<li>{@link android.content.pm.ActivityInfo} adds new constants for managing
376Activity orientation:
377{@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_FULL_SENSOR},
378{@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_REVERSE_LANDSCAPE},
379{@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_REVERSE_PORTRAIT},
380{@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_SENSOR_LANDSCAPE},
381and
382{@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_SENSOR_PORTRAIT}.
383</li>
384<li>New constant {@link
385android.app.ActivityManager.RunningAppProcessInfo#IMPORTANCE_PERCEPTIBLE} for
386the {@link android.app.ActivityManager.RunningAppProcessInfo#importance} field
387in {@link android.app.ActivityManager.RunningAppProcessInfo}. The value
388indicates that a specific process is running something that is considered to be
389actively perceptible to the user. An example would be an application performing
390background music playback.</li>
391<li>The Activity.setPersistent(boolean) method to mark an
392Activity as persistent is now deprecated and the implementation is a no-op.</li>
393</ul>
394</li>
395
396<li>Notification text and icon styles
397<ul>
398<li>New {@link android.R.style#TextAppearance_StatusBar_EventContent
399TextAppearance.StatusBar.EventContent},
400{@link android.R.style#TextAppearance_StatusBar_EventContent_Title
401TextAppearance.StatusBar.EventContent.Title},
402{@link android.R.style#TextAppearance_StatusBar_Icon
403TextAppearance.StatusBar.Icon}, and
404{@link android.R.style#TextAppearance_StatusBar_Title
405TextAppearance.StatusBar.Title} for managing
406notification style.</li>
407</ul>
408</li>
409
410<h3 id="extralargescreens">Extra Large Screens</h3>
411
412<p>The platform now supports extra large screen sizes, such as those that might
413be found on tablet devices. Developers can indicate that their applications are
414designed to support extra large screen sizes by adding a <code>&lt;supports
415screens ... android:xlargeScreens="true"&gt;</code> element to their manifest
416files. Applications can use a new resource qualifier, <code>xlarge</code>, to
417tag resources that are specific to extra large screens. For
418details on how to support extra large and other screen sizes, see <a
419href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
420Screens</a>.</p>
421
422<h3 id="graphics">Graphics</h3>
423
424<ul>
425<li>Adds remaining OpenGL ES 2.0 methods {@link
426android.opengl.GLES20#glDrawElements(int, int, int, int) glDrawElements()} and
427{@link android.opengl.GLES20#glVertexAttribPointer(int, int, int, boolean, int,
428int) glVertexAttribPointer()} in the {@link android.opengl.GLES20
429android.opengl.GLES20} class.</li>
430<li>Adds support for {@link android.graphics.ImageFormat#YV12} pixel format, a
431planar 4:2:0 YCrCb format.</li>
432</ul>
433
434<h3 id="providers">Content Providers</h3>
435
436<ul>
437<li>New {@link android.provider.AlarmClock} provider class for setting an alarm
438or handling an alarm. The provider contains a <code>ACTION_SET_ALARM</code> Intent
439action and extras that can be used to start an Activity to set a new alarm in an
440alarm clock application. Applications that wish to receive the
441<code>SET_ALARM</code> Intent should create an activity that requires the
442the SET_ALARM permission. Applications that wish to create a new
443alarm should use {@link
444android.content.Context#startActivity(android.content.Intent)
445Context.startActivity()}, so that the user has the option of choosing
446which alarm clock application to use.</li>
447
448<li>{@link android.provider.MediaStore} supports a new Intent action, {@link
449android.provider.MediaStore#INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH
450PLAY_FROM_SEARCH}, that lets an application search for music media and
451automatically play content from the result when possible. For example, an
452application could fire this Intent as the result of a voice recognition command
453to listen to music.</li>
454<li>{@link android.provider.MediaStore} also adds a new {@link
455android.provider.MediaStore#MEDIA_IGNORE_FILENAME} flag that tells the media
456scanner to ignore media in the containing directory and its subdirectories.
457Developers can use this to avoid having graphics appear in the Gallery and
458likewise prevent application sounds and music from showing up in the Music
459app.</li>
460
461<li>The {@link android.provider.Settings} provider adds the new Activity actions
462{@link android.provider.Settings#ACTION_APPLICATION_DETAILS_SETTINGS
463APPLICATION_DETAILS_SETTINGS} and {@link
464android.provider.Settings#ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS
465MANAGE_ALL_APPLICATIONS_SETTINGS}, which let an application show the details
466screen for a specific application or show the Manage Applications screen. </li>
467
468<li>The {@link android.provider.ContactsContract} provider adds the {@link
469android.provider.ContactsContract.CommonDataKinds.SipAddress} data kind, for
470storing a contact's SIP (Internet telephony) address. </li>
471</ul>
472
473<h3 id="location">Location</h3>
474
475<ul>
476<li>The {@link android.location.LocationManager} now tracks application
477requests that result in wake locks or wifi locks according to
478{@link android.os.WorkSource}, a system-managed class that identifies the
479application.
480<p>The <code>LocationManager</code> keeps track
481of all clients requesting periodic updates, and tells its providers
482about them as a <code>WorkSource</code> parameter, when setting their minimum
483update times.
484The network location provider uses <code>WorkSource</code> to track the
485wake and wifi locks initiated by an application and adds it to the application's
486battery usage reported in Manage Applications. </p></li>
487<li>The {@link android.location.LocationManager} adds several new methods that
488let an Activity register to receive periodic or one-time location updates based
489on specified criteria (see below).</li>
490<li>A new  {@link android.location.Criteria} class lets an application specify a
491set of criteria for selecting a location provider. For example, providers may be
492ordered according to accuracy, power usage, ability to report altitude, speed,
493and bearing, and monetary cost. </li>
494</ul>
495
496<h3 id="storage">Storage</h3>
497
498<ul>
499<li>Android 2.3 adds a new {@link android.os.storage.StorageManager} that
500supports OBB (Opaque Binary Blob) files. Although platform support for OBB is
501available in Android 2.3, development tools for creating and managing OBB files
502will not be availble until early 2011.</li>
503<li>The Android 2.3 platform adds official support for devices that do not
504include SD cards (although it provides virtual SD Card partition, when no
505physical SD card is available). A convenience method, {@link
506android.os.Environment#isExternalStorageRemovable()}, lets applications
507determine whether a physical SD card is present.</li>
508</ul>
509
510<h3 id="packagemanager">Package Manager</h3>
511
512<ul>
513<li>New constants for declaring hardware and software features. See the list in
514the <a href="#feature_constants">New Feature Constants</a> section, below.</li>
515<li>{@link android.content.pm.PackageInfo} adds new {@link
516android.content.pm.PackageInfo#firstInstallTime} and {@link
517android.content.pm.PackageInfo#lastUpdateTime} fields that store the time of the
518package installation and last update. </li>
519<li>New {@link
520android.content.pm.PackageManager#getProviderInfo(android.content.ComponentName,
521int) getProviderInfo()} method for retrieving all of the information known about
522a particular content provider class.</li>
523</ul>
524
525<h3 id="telephony">Telephony</h3>
526
527<ul>
528<li>The {@link android.telephony.TelephonyManager} adds the constant {@link
529android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B} for specifying the CDMA
530EVDO Rev B network type.</li>
531<li>New {@link android.telephony.gsm.GsmCellLocation#getPsc()} method returns
532the primary scrambling code of the serving cell on a UMTS network.</li>
533</ul>
534
535<h3 id="native">Native access to Activity lifecycle, windows</h3>
536
537<p>Android 2.3 exposes a broad set of APIs to applications that use native
538code. Framework classes of interest to such applications include: </p>
539
540<ul>
541<li>{@link android.app.NativeActivity} is a new type of Activity class, whose
542lifecycle callbacks are implemented directly in native code. A
543<code>NativeActivity</code> and its underlying native code run in the system
544just as do other Activities &mdash; specifically they run in the Android
545application's system process and execute on the application's main UI thread,
546and they receive the same lifecycle callbacks as do other Activities. </li>
547<li>New {@link android.view.InputQueue} class and callback interface lets native
548code manage event queueing. </li>
549<li>New {@link android.view.SurfaceHolder.Callback2} interface lets native code
550manage a {@link android.view.SurfaceHolder}. </li>
551<li>New {@link
552android.view.Window#takeInputQueue(android.view.InputQueue.Callback)
553takeInputQueue} and {@link
554android.view.Window#takeSurface(android.view.SurfaceHolder.Callback2)
555takeSurface()} methods in {@link android.view.Window} let native code manage
556events and surfaces.</li>
557</ul>
558
559<p>For full information on working with native code or to download the NDK,
560see the <a href="{@docRoot}tools/sdk/ndk/index.html">Android NDK</a> page.</p>
561
562
563<h3 id="dalvik">Dalvik Runtime</h3>
564
565<ul>
566<li>{@link dalvik.system dalvik.system}
567removes several classes that were previously deprecated.</li>
568<li>Dalvik core libraries:
569<ul>
570  <li>New collections: {@link java.util.ArrayDeque}, {@link java.util.NavigableMap},
571  {@link java.util.concurrent.ConcurrentSkipListMap},
572  {@link java.util.concurrent.LinkedBlockingDeque}</li>
573  <li>New {@link java.util.Arrays} utilities: <code>binarySearch()</code>,
574  <code>copyOf()</code>, <code>copyOfRange()</code>, and others.</li>
575  <li>{@link java.net.CookieManager} for {@link java.net.HttpURLConnection}.</li>
576  <li>More complete network APIs: {@link java.net.InterfaceAddress},
577  {@link java.net.NetworkInterface} and {@link java.net.IDN}</li>
578  <li>{@link java.io.File} read and write controls</li>
579  <li>{@link java.lang.String#isEmpty() String.isEmpty()}</li>
580  <li>{@link java.text.Normalizer} and {@link java.text.Normalizer.Form}</li>
581  <li>Improved {@link javax.net.ssl} server sockets.</li>
582</ul>
583</li>
584</ul>
585
586<h3 id="manifest">New manifest elements and attributes</h3>
587
588<ul>
589<li>New <code>xlargeScreens</code> attribute for <a
590href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
591&lt;supports-screens&gt;}</a>
592element, to indicate whether the application supports
593extra large screen form-factors. For details, see <a
594href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
595Screens</a>.</li>
596<li>New values for <code>android:screenOrientation</code> attribute of
597<code>&lt;activity&gt;</code> element:
598<ul>
599<li><code>"reverseLandscape"</code> &mdash; The Activity would like to have the
600screen in landscape orientation, turned in the opposite direction from normal
601landscape.</li>
602<li><code>"reversePortrait"</code> &mdash; The Activity would like to have the
603screen in portrait orientation, turned in the opposite direction from normal
604portrait.</li>
605<li><code>"sensorLandscape"</code> &mdash; The Activity would like to have the
606screen in landscape orientation, but can use the sensor to change which
607direction the screen is facing.</li>
608<li><code>"sensorPortrait"</code> &mdash; The Activity would like to have the
609screen in portrait orientation, but can use the sensor to change which direction
610the screen is facing.</li>
611<li><code>"fullSensor"</code> &mdash; Orientation is determined by a physical
612orientation sensor: the display will rotate based on how the user moves the
613device. This allows any of the 4 possible rotations, regardless of what the
614device will normally do (for example some devices won't normally use 180 degree
615rotation).</li>
616</ul>
617</li>
618</ul>
619
620<h3 id="permissions">New Permissions</h3>
621
622<ul>
623<li><code>com.android.permission.SET_ALARM</code> &mdash; Allows an application
624to broadcast an Intent to set an alarm for the user. An Activity that handles
625the {@link android.provider.AlarmClock#ACTION_SET_ALARM SET_ALARM} Intent action
626should require this permission.</li>
627<li><code>android.permission.USE_SIP</code> &mdash; Allows an application to use
628the {@link android.net.sip SIP API} to make or receive internet calls.
629<li><code>android.permission.NFC</code> &mdash; Allows an application to use the
630{@link android.nfc NFC API} to read NFC tags.</li>
631</ul>
632
633<h3 id="feature_constants">New Feature Constants</h3>
634
635<p>The platform adds several new hardware features that developers can declare
636in their application manifests as being required by their applications. This
637lets developers control how their application is filtered, when published on
638Google Play. </p>
639
640<ul>
641<li>{@link android.content.pm.PackageManager#FEATURE_AUDIO_LOW_LATENCY
642android.hardware.audio.low_latency} &mdash; The application uses a low-latency
643audio pipeline on the device and is sensitive to delays or lag in sound input or
644output.</li>
645<li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_FRONT
646android.hardware.camera.front} &mdash; The application uses a front-facing
647camera on the device.</li>
648<li>{@link android.content.pm.PackageManager#FEATURE_NFC android.hardware.nfc}
649&mdash; The application uses NFC radio features in the device.</li>
650<li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_BAROMETER
651android.hardware.sensor.barometer} &mdash; The application uses the device's
652barometer.</li>
653<li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_GYROSCOPE
654android.hardware.sensor.gyroscope} &mdash; The application uses the device's
655gyroscope sensor.</li>
656<li>{@link android.content.pm.PackageManager#FEATURE_SIP android.software.sip}
657&mdash; The application uses the SIP API on the device.</li>
658<li>{@link android.content.pm.PackageManager#FEATURE_SIP_VOIP
659android.software.sip.voip} &mdash; The application uses a SIP-based VoIP
660service on the device.</li>
661<li>{@link
662android.content.pm.PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND
663android.hardware.touchscreen.multitouch.jazzhand} &mdash; The application uses
664advanced multipoint multitouch capabilities on the device screen, for tracking
665five or more points fully independently.</li>
666</ul>
667
668<p>For full information about how to declare features and use them for
669filtering, see the documentation for <a
670href="{@docRoot}guide/topics/manifest/uses-feature-element.html"><code>&lt;uses-feature&gt;</code></a>.</p>
671
672<h3 id="api-diff">API differences report</h3>
673
674<p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API
675Level {@sdkPlatformApiLevel}), see the <a
676href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API
677Differences Report</a>.</p>
678
679
680<h2 id="api-level">API Level</h2>
681
682<p>The Android {@sdkPlatformVersion} platform delivers an updated version of
683the framework API. The Android {@sdkPlatformVersion} API
684is assigned an integer identifier &mdash;
685<strong>{@sdkPlatformApiLevel}</strong> &mdash; that is
686stored in the system itself. This identifier, called the "API Level", allows the
687system to correctly determine whether an application is compatible with
688the system, prior to installing the application. </p>
689
690<p>To use APIs introduced in Android {@sdkPlatformVersion} in your application,
691you need compile the application against the Android library that is provided in
692the Android {@sdkPlatformVersion} SDK platform. Depending on your needs, you might
693also need to add an <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code>
694attribute to the <code>&lt;uses-sdk&gt;</code> element in the application's
695manifest. If your application is designed to run only on Android 2.3 and higher,
696declaring the attribute prevents the application from being installed on earlier
697versions of the platform.</p>
698
699<p>For more information, read <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">What is API
700Level?</a></p>
701