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