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