1 page.title=Android 2.3 APIs 2 excludeFromSuggestions=true 3 sdk.platform.version=2.3 4 sdk.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 21 href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API 22 Differences 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 33 downloadable component for the Android SDK. The downloadable platform includes 34 an Android library and system image, as well as a set of emulator skins and 35 more. To get started developing or testing against Android {@sdkPlatformVersion}, 36 use 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 44 in {@sdkPlatformVersion}, including new features and changes in the framework 45 API 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 51 developers build internet telephony applications. Using the API, applications can offer 52 voice calling features without having to manage sessions, transport-level 53 communication, or audio — these are handled 54 transparently 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} 57 package. The key class is {@link android.net.sip.SipManager}, which applications 58 use to set up and manage SIP profiles, then initiate audio calls and receive 59 audio calls. Once an audio call is established, applications can mute calls, 60 turn 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 platforms underlying SIP stack and services are available on devices at 64 the discretion of the manufacturer and associated carrier. For this reason, 65 applications should use the {@link android.net.sip.SipManager#isApiSupported 66 isApiSupported()} method to check whether SIP support is available, before 67 exposing calling functionality to users. </p> 68 69 <p>To use the SIP API, applications must request permission from the user by 70 declaring <code><uses-permission 71 android:name="android.permission.INTERNET"></code> and <code><uses-permission 72 android:name="android.permission.USE_SIP"></code> in their manifest files.</p> 73 74 <p>Additionally, developers can request filtering on Google Play, such that 75 their applications are not discoverable to users whose devices do not include 76 the platforms SIP stack and services. To request filtering, add <code><uses-feature 77 android:name="android.software.sip" 78 android:required="true"></code> and <code><uses-feature 79 android:name="android.software.sip.voip"></code> to the application manifest.</p> 80 81 <p class="note">For more information, read the <a 82 href="{@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 87 read NDEF tags that are discovered as a user touches an NFC-enabled device 88 to 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 91 hardware to discover tags when they come into range. On discovering a tag, the 92 platform notifies applications by broadcasting an Intent, appending the tag's 93 NDEF messages to the Intent as extras. Applications can create Intent filters to 94 recognize and handle targeted tags and messages. For example, after receiving a 95 tag by Intent, applications extract the NDEF messages, store them, alert the 96 user, 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, 102 the standard format in which "records" carrying data are transmitted between 103 devices and tags. Applications can receive these messages from {@link 104 android.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 107 carries the data itself.</li> 108 </ul> 109 110 <p>NFC communication relies on wireless technology in the device hardware, so 111 support for the platform's NFC features on specific devices is determined by 112 their manufacturers. To determine the NFC support on the current device, 113 applications can call {@link android.nfc.NfcAdapter#isEnabled isEnabled()} to 114 query the {@link android.nfc.NfcAdapter}. The NFC API is always present, 115 however, regardless of underlying hardware support.</p> 116 117 <p>To use the NFC API, applications must request permission from the user by 118 declaring <code><uses-permission 119 android:name="android.permission.NFC"></code> in their manifest files.</p> 120 121 <p>Additionally, developers can request filtering on Google Play, such that 122 their applications are not discoverable to users whose devices do not support 123 NFC. To request filtering, add 124 <code><uses-feature android:name="android.hardware.nfc" 125 android: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 133 types — gyroscope, rotation vector, linear acceleration, gravity, and barometer. 134 Developers can use the new sensor readings to create applications that respond 135 quickly and smoothly to precise changes in device position and motion. The 136 Sensor API reports gyroscope and other sensor changes to interested 137 applications, whether they are running on the application framework or in native 138 code. </p> 139 140 <p>Note that the specific set of hardware sensors available on any given device 141 varies at the discretion of the device manufacturer. </p> 142 143 <p>Developers can request filtering on Google Play, such that their 144 applications are not discoverable to users whose devices do not offer a 145 gyroscope sensor. To do so, add <code><uses-feature 146 android:name="android.hardware.sensor.gyroscope" 147 android: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, 155 for either photo or video capture. The {@link android.hardware.Camera} lets 156 applications query for the number of cameras available and the unique 157 characteristics of each. </p> 158 159 <ul> 160 <li>New {@link android.hardware.Camera.CameraInfo} class stores a camera's 161 positional characteristics (orientation, front-facing or back-facing).</li> 162 <li>New {@link android.hardware.Camera#getNumberOfCameras()} and {@link 163 android.hardware.Camera#getCameraInfo(int,CameraInfo) getCameraInfo()} methods in the {@link 164 android.hardware.Camera} class let applications query for the cameras available 165 and open the camera that they need.</li> 166 <li>New {@link android.media.CamcorderProfile#get get()} method lets 167 applications retrieve a {@link android.media.CamcorderProfile} for a specific camera. </li> 168 <li>New {@link android.media.CameraProfile#getJpegEncodingQualityParameter(int, int) 169 getJpegEncodingQualityParameter()} lets applications obtain the still-image 170 capture 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> 174 in 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 179 preview fps maximum/minimum. New {@link 180 android.hardware.Camera.Parameters#getFocusDistances(float[]) 181 getFocusDistances()}, {@link 182 android.hardware.Camera.Parameters#getPreviewFpsRange(int[]) 183 getPreviewFpsRange()}, and {@link 184 android.hardware.Camera.Parameters#getSupportedPreviewFpsRange() 185 getSupportedPreviewFpsRange()} for getting camera parameters, as well as {@link 186 android.hardware.Camera.Parameters#setPreviewFpsRange(int, int) 187 setPreviewFpsRange()} 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, 193 including bass boost, headphone virtualization, equalization, and reverb.</p> 194 <ul> 195 <li>New {@link android.media.audiofx android.media.audiofx} package provides the 196 API to access audio effects.</li> 197 <li>New {@link android.media.audiofx.AudioEffect AudioEffect} is the base class 198 for controlling audio effects provided by the Android audio framework. 199 <li>New audio session ID that lets an application associate a set of audio 200 effects with an instance of {@link android.media.AudioTrack} or {@link 201 android.media.MediaPlayer}.</li> 202 <li>New {@link android.media.AudioTrack#AudioTrack(int, int, int, int, int, int, 203 int) AudioTrack} class constructor that lets you create an {@link 204 android.media.AudioTrack} with a specific session ID. New {@link 205 android.media.AudioTrack#attachAuxEffect(int) attachAuxEffect()}, {@link 206 android.media.AudioTrack#getAudioSessionId() getAudioSessionId()}, and {@link 207 android.media.AudioTrack#setAuxEffectSendLevel(float) setAuxEffectSendLevel()} 208 methods.</li> 209 <li>New {@link android.media.MediaPlayer#attachAuxEffect(int) 210 attachAuxEffect()}, {@link android.media.MediaPlayer#getAudioSessionId() 211 getAudioSessionId()}, {@link android.media.MediaPlayer#setAudioSessionId(int) 212 setAudioSessionId(int)}, and {@link 213 android.media.MediaPlayer#setAuxEffectSendLevel(float) setAuxEffectSendLevel()} 214 methods 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> 219 in 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 225 retrieve the value of the EXIF altitude tag.</li> 226 <li>New {@link android.media.MediaRecorder#setOrientationHint(int) 227 setOrientationHint()} method lets an application tell {@link 228 android.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 234 that handles long-running HTTP downloads. Applications can request that a URI be 235 downloaded to a particular destination file. The <code>DownloadManager</code> 236 will conduct the download in the background, taking care of HTTP interactions 237 and retrying downloads after failures or across connectivity changes and system 238 reboots. </p> 239 <ul> 240 <li>Applications can obtain an instance of the {@link android.app.DownloadManager} 241 class by calling {@link 242 android.content.Context#getSystemService(String)} and passing 243 {@link android.content.Context#DOWNLOAD_SERVICE}. Applications that request 244 downloads through this API should register a broadcast receiver for {@link 245 android.app.DownloadManager#ACTION_NOTIFICATION_CLICKED}, to appropriately 246 handle when the user clicks on a running download in a notification or from the 247 Downloads UI.</li> 248 <li>The {@link android.app.DownloadManager.Request} class lets an 249 application provide all the information necessary to request a new download, 250 such as request URI and download destination. A request URI is the only required 251 parameter. Note that the default download destination is a shared volume where 252 the system can delete your file if it needs to reclaim space for system use. For 253 persistent storage of a download, specify a download destination on external 254 storage (see {@link 255 android.app.DownloadManager.Request#setDestinationUri(Uri)}).</li> 256 <li>The {@link android.app.DownloadManager.Query} class provides methods that let 257 an 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, 263 the platform offers a new system facility called {@link android.os.StrictMode}. 264 When implemented in an application, StrictMode catches and notifies the 265 developer of accidental disk or network activity that could degrade application 266 performance, such as activity taking place on the application's main thread 267 (where UI operations are received and animations are also taking place). 268 Developers can evaluate the network and disk usages issues raised in StrictMode 269 and correct them if needed, keeping the main thread more responsive and 270 preventing 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 274 point with the system and VM. The class provides convenience methods for 275 managing the thread and VM policies that apply to the instance.</li> 276 <li>{@link android.os.StrictMode.ThreadPolicy} and {@link 277 android.os.StrictMode.VmPolicy} hold the policies that you define and apply to 278 thread and VM instances.</li> 279 </ul> 280 281 <p>For more information about how to use StrictMode to optimize your 282 application, see the class documentation and sample code at {@link 283 android.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 291 enable/disable overscroll for a given view, set the overscoll mode, control the 292 overscroll distance, and handle the results of overscrolling. </li> 293 <li>In Widgets, applications can control overscroll characteristics such as 294 animation, springback, and overscroll distance. For more information, see {@link 295 android.view.View android.view.View} and {@link android.widget.OverScroller 296 android.widget.OverScroller}. </li> 297 <li>{@link android.view.ViewConfiguration} also provides methods {@link 298 android.view.ViewConfiguration#getScaledOverflingDistance()} and {@link 299 android.view.ViewConfiguration#getScaledOverscrollDistance()}.</li> 300 <li>New <code>overScrollMode</code>, <code>overScrollFooter</code>, and 301 <code>overScrollHeader</code> attributes for <code><ListView></code> elements, 302 for 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 309 security of Views that provide access to sensitive functionality. For example, 310 touch filtering is appropriate to ensure the security of user actions such as 311 granting a permission request, making a purchase, or clicking on an 312 advertisement. For details, see the <a 313 href="{@docRoot}reference/android/view/View.html#Security">View class 314 documentation</a>.</li> 315 <li>New <code>filterTouchesWhenObscured</code> attribute for view elements, 316 which declares whether to filter touches when the view's window is obscured by 317 another visible window. When set to <code>"true"</code>, the view will not 318 receive touches whenever a toast, dialog or other window appears above the 319 view's window. Refer to <a 320 href="{@docRoot}reference/android/view/View.html#Security">View security 321 documentation</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> 326 in 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 332 provides methods that let applications determine the meaning of the event, such 333 as by querying for the InputDevice from which the event orginated. The {@link 334 android.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 337 class stores information about the capabilities of a particular input device and 338 provides methods that let applications determine how to interpret events from an 339 input 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" 346 information, which lets applications to keep track of individual fingers as they 347 move up and down. The class adds a variety of methods that let an application 348 work efficiently with motion events.</li> 349 <li>The input system now has logic to generate motion events with the new 350 pointer ID information, synthesizing identifiers as new pointers are down. The 351 system tracks multiple pointer IDs separately during a motion event, and 352 ensures proper continuity of pointers by evaluating at the distance 353 between 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 360 region of text as composing text, maintaining the current styling. A 361 <code>getSelectedText</code> method returns the selected text to the 362 application. The methods are available in {@link 363 android.view.inputmethod.BaseInputConnection}, {@link 364 android.view.inputmethod.InputConnection}, and {@link 365 android.view.inputmethod.InputConnectionWrapper}.</li> 366 <li>New <code>textSelectHandle</code>, <code>textSelectHandleLeft</code>, 367 <code>textSelectHandleRight</code>, and <code>textSelectHandleWindowStyle</code> 368 attributes for <code><TextView></code>, for referencing drawables that will be 369 used to display text-selection anchors and the style for the containing 370 window.</li> 371 </ul> 372 </li> 373 374 <li>Activity controls 375 <ul> 376 <li>{@link android.content.pm.ActivityInfo} adds new constants for managing 377 Activity 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}, 382 and 383 {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_SENSOR_PORTRAIT}. 384 </li> 385 <li>New constant {@link 386 android.app.ActivityManager.RunningAppProcessInfo#IMPORTANCE_PERCEPTIBLE} for 387 the {@link android.app.ActivityManager.RunningAppProcessInfo#importance} field 388 in {@link android.app.ActivityManager.RunningAppProcessInfo}. The value 389 indicates that a specific process is running something that is considered to be 390 actively perceptible to the user. An example would be an application performing 391 background music playback.</li> 392 <li>The Activity.setPersistent(boolean) method to mark an 393 Activity 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 400 TextAppearance.StatusBar.EventContent}, 401 {@link android.R.style#TextAppearance_StatusBar_EventContent_Title 402 TextAppearance.StatusBar.EventContent.Title}, 403 {@link android.R.style#TextAppearance_StatusBar_Icon 404 TextAppearance.StatusBar.Icon}, and 405 {@link android.R.style#TextAppearance_StatusBar_Title 406 TextAppearance.StatusBar.Title} for managing 407 notification 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 414 be found on tablet devices. Developers can indicate that their applications are 415 designed to support extra large screen sizes by adding a <code><supports 416 screens ... android:xlargeScreens="true"></code> element to their manifest 417 files. Applications can use a new resource qualifier, <code>xlarge</code>, to 418 tag resources that are specific to extra large screens. For 419 details on how to support extra large and other screen sizes, see <a 420 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple 421 Screens</a>.</p> 422 423 <h3 id="graphics">Graphics</h3> 424 425 <ul> 426 <li>Adds remaining OpenGL ES 2.0 methods {@link 427 android.opengl.GLES20#glDrawElements(int, int, int, int) glDrawElements()} and 428 {@link android.opengl.GLES20#glVertexAttribPointer(int, int, int, boolean, int, 429 int) glVertexAttribPointer()} in the {@link android.opengl.GLES20 430 android.opengl.GLES20} class.</li> 431 <li>Adds support for {@link android.graphics.ImageFormat#YV12} pixel format, a 432 planar 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 439 or handling an alarm. The provider contains a <code>ACTION_SET_ALARM</code> Intent 440 action and extras that can be used to start an Activity to set a new alarm in an 441 alarm clock application. Applications that wish to receive the 442 <code>SET_ALARM</code> Intent should create an activity that requires the 443 the SET_ALARM permission. Applications that wish to create a new 444 alarm should use {@link 445 android.content.Context#startActivity(android.content.Intent) 446 Context.startActivity()}, so that the user has the option of choosing 447 which alarm clock application to use.</li> 448 449 <li>{@link android.provider.MediaStore} supports a new Intent action, {@link 450 android.provider.MediaStore#INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH 451 PLAY_FROM_SEARCH}, that lets an application search for music media and 452 automatically play content from the result when possible. For example, an 453 application could fire this Intent as the result of a voice recognition command 454 to listen to music.</li> 455 <li>{@link android.provider.MediaStore} also adds a new {@link 456 android.provider.MediaStore#MEDIA_IGNORE_FILENAME} flag that tells the media 457 scanner to ignore media in the containing directory and its subdirectories. 458 Developers can use this to avoid having graphics appear in the Gallery and 459 likewise prevent application sounds and music from showing up in the Music 460 app.</li> 461 462 <li>The {@link android.provider.Settings} provider adds the new Activity actions 463 {@link android.provider.Settings#ACTION_APPLICATION_DETAILS_SETTINGS 464 APPLICATION_DETAILS_SETTINGS} and {@link 465 android.provider.Settings#ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS 466 MANAGE_ALL_APPLICATIONS_SETTINGS}, which let an application show the details 467 screen for a specific application or show the Manage Applications screen. </li> 468 469 <li>The {@link android.provider.ContactsContract} provider adds the {@link 470 android.provider.ContactsContract.CommonDataKinds.SipAddress} data kind, for 471 storing 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 478 requests that result in wake locks or wifi locks according to 479 {@link android.os.WorkSource}, a system-managed class that identifies the 480 application. 481 <p>The <code>LocationManager</code> keeps track 482 of all clients requesting periodic updates, and tells its providers 483 about them as a <code>WorkSource</code> parameter, when setting their minimum 484 update times. 485 The network location provider uses <code>WorkSource</code> to track the 486 wake and wifi locks initiated by an application and adds it to the application's 487 battery usage reported in Manage Applications. </p></li> 488 <li>The {@link android.location.LocationManager} adds several new methods that 489 let an Activity register to receive periodic or one-time location updates based 490 on specified criteria (see below).</li> 491 <li>A new {@link android.location.Criteria} class lets an application specify a 492 set of criteria for selecting a location provider. For example, providers may be 493 ordered according to accuracy, power usage, ability to report altitude, speed, 494 and 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 501 supports OBB (Opaque Binary Blob) files. Although platform support for OBB is 502 available in Android 2.3, development tools for creating and managing OBB files 503 will not be availble until early 2011.</li> 504 <li>The Android 2.3 platform adds official support for devices that do not 505 include SD cards (although it provides virtual SD Card partition, when no 506 physical SD card is available). A convenience method, {@link 507 android.os.Environment#isExternalStorageRemovable()}, lets applications 508 determine 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 515 the <a href="#feature_constants">New Feature Constants</a> section, below.</li> 516 <li>{@link android.content.pm.PackageInfo} adds new {@link 517 android.content.pm.PackageInfo#firstInstallTime} and {@link 518 android.content.pm.PackageInfo#lastUpdateTime} fields that store the time of the 519 package installation and last update. </li> 520 <li>New {@link 521 android.content.pm.PackageManager#getProviderInfo(android.content.ComponentName, 522 int) getProviderInfo()} method for retrieving all of the information known about 523 a 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 530 android.telephony.TelephonyManager#NETWORK_TYPE_EVDO_B} for specifying the CDMA 531 EVDO Rev B network type.</li> 532 <li>New {@link android.telephony.gsm.GsmCellLocation#getPsc()} method returns 533 the 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 539 code. 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 543 lifecycle callbacks are implemented directly in native code. A 544 <code>NativeActivity</code> and its underlying native code run in the system 545 just as do other Activities — specifically they run in the Android 546 application's system process and execute on the application's main UI thread, 547 and they receive the same lifecycle callbacks as do other Activities. </li> 548 <li>New {@link android.view.InputQueue} class and callback interface lets native 549 code manage event queueing. </li> 550 <li>New {@link android.view.SurfaceHolder.Callback2} interface lets native code 551 manage a {@link android.view.SurfaceHolder}. </li> 552 <li>New {@link 553 android.view.Window#takeInputQueue(android.view.InputQueue.Callback) 554 takeInputQueue} and {@link 555 android.view.Window#takeSurface(android.view.SurfaceHolder.Callback2) 556 takeSurface()} methods in {@link android.view.Window} let native code manage 557 events and surfaces.</li> 558 </ul> 559 560 <p>For full information on working with native code or to download the NDK, 561 see 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} 568 removes 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 591 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code 592 <supports-screens>}</a> 593 element, to indicate whether the application supports 594 extra large screen form-factors. For details, see <a 595 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple 596 Screens</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 601 screen in landscape orientation, turned in the opposite direction from normal 602 landscape.</li> 603 <li><code>"reversePortrait"</code> — The Activity would like to have the 604 screen in portrait orientation, turned in the opposite direction from normal 605 portrait.</li> 606 <li><code>"sensorLandscape"</code> — The Activity would like to have the 607 screen in landscape orientation, but can use the sensor to change which 608 direction the screen is facing.</li> 609 <li><code>"sensorPortrait"</code> — The Activity would like to have the 610 screen in portrait orientation, but can use the sensor to change which direction 611 the screen is facing.</li> 612 <li><code>"fullSensor"</code> — Orientation is determined by a physical 613 orientation sensor: the display will rotate based on how the user moves the 614 device. This allows any of the 4 possible rotations, regardless of what the 615 device will normally do (for example some devices won't normally use 180 degree 616 rotation).</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 625 to broadcast an Intent to set an alarm for the user. An Activity that handles 626 the {@link android.provider.AlarmClock#ACTION_SET_ALARM SET_ALARM} Intent action 627 should require this permission.</li> 628 <li><code>android.permission.USE_SIP</code> — Allows an application to use 629 the {@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 637 in their application manifests as being required by their applications. This 638 lets developers control how their application is filtered, when published on 639 Google Play. </p> 640 641 <ul> 642 <li>{@link android.content.pm.PackageManager#FEATURE_AUDIO_LOW_LATENCY 643 android.hardware.audio.low_latency} — The application uses a low-latency 644 audio pipeline on the device and is sensitive to delays or lag in sound input or 645 output.</li> 646 <li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_FRONT 647 android.hardware.camera.front} — The application uses a front-facing 648 camera 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 652 android.hardware.sensor.barometer} — The application uses the device's 653 barometer.</li> 654 <li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_GYROSCOPE 655 android.hardware.sensor.gyroscope} — The application uses the device's 656 gyroscope 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 660 android.software.sip.voip} — The application uses a SIP-based VoIP 661 service on the device.</li> 662 <li>{@link 663 android.content.pm.PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND 664 android.hardware.touchscreen.multitouch.jazzhand} — The application uses 665 advanced multipoint multitouch capabilities on the device screen, for tracking 666 five or more points fully independently.</li> 667 </ul> 668 669 <p>For full information about how to declare features and use them for 670 filtering, see the documentation for <a 671 href="{@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 676 Level {@sdkPlatformApiLevel}), see the <a 677 href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API 678 Differences 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 684 the framework API. The Android {@sdkPlatformVersion} API 685 is assigned an integer identifier — 686 <strong>{@sdkPlatformApiLevel}</strong> — that is 687 stored in the system itself. This identifier, called the "API Level", allows the 688 system to correctly determine whether an application is compatible with 689 the system, prior to installing the application. </p> 690 691 <p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, 692 you need compile the application against the Android library that is provided in 693 the Android {@sdkPlatformVersion} SDK platform. Depending on your needs, you might 694 also need to add an <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> 695 attribute to the <code><uses-sdk></code> element in the application's 696 manifest. If your application is designed to run only on Android 2.3 and higher, 697 declaring the attribute prevents the application from being installed on earlier 698 versions 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 701 Level?</a></p> 702