原文转载:http://www.android123.com.cn/androidyizhi/718.html
Android 2.3的API Level为9,有关所有的API改变。
新增包android.media.audiofx 混响音效
android.net.sip VOIP支持
android.nfc NFC支付支持
android.os.storage 存储管理类 详细的请查看 Android 2.3新特性及改进列表,已
正式发布
移除类VMDebug VMRuntime VMStack Zygote 更多改进
Extra Large Screens 目前Android 2.3将支持更大的屏幕尺寸定义,开发者可以通过 <supports screens ... android:xlargeScreens="true"> 元素在你的 manifest
files 中定义,新增的 xlarge 标记将支持更多的屏幕尺寸,
Graphics
* 添加保留了OpenGL ES 2.0 中的 glDrawElements() 和 glVertexAttribPointer() 方法在 android.opengl.GLES20 类中.
* 新增YV12 pixel 格式和 4:2:0 YCrCb 格式的支持。
Content Providers
* New AlarmClock provider class for setting an alarm or handling an alarm. The provider contains a ACTION_SET_AL
ARM Intent action and extras that
can be used to start an Activity to set a new alarm in an alarm clock application. Applications that wish to receive the SET_ALARM Intent should create an activity that requires the the SET_ALARM permission. Applications that wish to create a new alarm should use Context.startActivity(), so that the user
has the option of choosing which alarm clock application to use.
* MediaStore supports a new Intent action, PLAY_FROM_SEARCH, that lets an application search for music media and automatically play content from the result when possible. For example, an application could fire this Intent as the result of a voice recognition
command to listen to music.
* MediaStore also adds a new MEDIA_IGNORE_FILENAME flag that tells the media scanner to ignore media in the containing directory and its subdirectories.
Developers can use this to avoid having graphics appear in the Gallery and likewise prevent application sounds and music from showing up in the Music app.
* The Settings provider adds the new Activity actions
APPLICATION_DETAILS_SETTINGS and MANAGE_ALL_APPLICATIONS_SETTINGS, which let an application show the details screen for a specific application or show the Manage Applications screen.
* The ContactsContract provider adds the ContactsContract.CommonDataKinds.SipAddress data kind, for storing a contact's SIP (Internet telephony) address.
Location
* LocationManager 类可以跟踪程序请求wake locks 或 wifi locks 的结果通过 to WorkSource 类,让
系统管理指定的程序.The LocationManager keeps track of all clients requesting periodic updates, and tells its providers about them as a WorkSource parameter, when setting their minimum update times. The network location provider uses WorkSource to track the wake and wifi locks initiated by an application and adds it to the application's battery usage reported in Manage Applications.
* The LocationManager adds several new methods that let an Activity register to receive periodic or one-time location updates based on specified criteria (see below).
* A new Criteria class lets an application specify a set of criteria for selecting a location provider. For example, providers may be ordered according to accuracy, power usage, ability to report altitude, speed, and bearing, and monetary cost.
Storage
* Android 2.3 新增 StorageManager 类支持 OBB (Opaque Binary Blob) 文件在 Android 2.3上开发恐惧创建和管理OBB文件将在2011年早期无法使用。
* 加入一些判断虚拟SD分区,Android123提示大家,类似
三星i9000可能存在虚拟的SD路径,所以 isExternalStorageRemovable() 可以知道是否是一个物理的SD卡.
Package Manager
* PackageInfo 新增 firstInstallTime 和 lastUpdateTime 可以查看一个软件的安装和上次更新时间,这比直接获取APK路径查看文件时间更可靠,对于付费的私有路径未root的机型无权限获取的。
* 新增 getProviderInfo() 方法获取content provider类相关信息.
Telephony
* TelephonyManager 增加了对CDMA EVDO Rev B网络类型的定义NETWORK_TYPE_EVDO_B.
* 新的 getPsc() 返回私有混合码从UMTS网络.
Android 2.3 可以让应用本地访问声明周期和窗口
NativeActivity是一个新的Activity类整个声明周期的方法可以通过本地C/C++代码直接访问,使用Android NDK r5或更高
版本即可支持。
* 新增 InputQueue 类提供本地管理事件
队列的回调
接口
* 新增 SurfaceHolder.Callback2 接口可以让C/C++代码管理 SurfaceHolder.
* 新增 takeInputQueue 和 takeSurface() 让本地代码管理一个窗口事件.
有关最新版的NDK下载和NDK参考文档可以在
Android开发包下载中找到。
有关Dalvik运行时库
* dalvik.
system 移除了很多类,在上一版本这些类已经标记为将放弃使用包含以下
* Dalvik 核心库:
o 新增 collections: ArrayDeque, NavigableMap, ConcurrentSkipListMap, LinkedBlockingDeque 数据类型
o 新增 Arrays 辅助方法: binarySearch(), copyOf(), copyOfRange(), and others.
o 新增CookieManager针对HttpURLConnection.
o 更完整的网络API支持比如 InterfaceAddress, NetworkInterface 和 IDN
o 文件读写控制
o String.isEmpty()
o Normalizer 和 Normalizer.Form
o 改进了 javax.net.ssl server
sockets.
新增manifest元素和属性
* 新增 xlargeScreens 属性针对 <supports-screens> 元素,可以支持更大
设备比如说Android平板的定义。
* 新的屏幕方向属性 android:screenOrientation 在<activity> 中
o "reverseLandscape" — The Activity would like to have the screen in landscape orientation, turned in the opposite direction from normal landscape.
o "reversePortait" — The Activity would like to have the screen in portrait orientation, turned in the opposite direction from normal portrait.
o "sensorLandscape" — The Activity would like to have the screen in landscape orientation, but can use the sensor to change which direction the screen is facing.
o "sensorPortrait" — The Activity would like to have the screen in portrait orientation, but can use the sensor to change which direction the screen is facing.
o "fullSensor" — Orientation is determined by a physical orientation sensor: the display will
rotate based on how the user moves the device. This allows any of the 4 possible rotations, regardless of what the device will normally do (for example some devices won't normally use 180 degree rotation).
新增 Permissions
* com.android.permission.SET_ALARM —设置一个提醒权限.
* android.permission.USE_SIP — 使用SIP接收一个VOIP.
* android.permission.NFC — 允许程序使用NFC支持
有关硬件的改进如下
android.hardware.audio.low_latency — 允许使用 low-latency 音频管道在设备和可以提供敏感的延迟在声音输出输出上。
android.hardware.camera.front — 前置摄像头控制类.
android.hardware.nfc — NFC近距无线设备管理.
android.hardware.sensor.barometer — 气压计感应器支持类The application uses the device's barometer.
android.hardware.sensor.gyroscope — 陀螺仪感应器支持类 The application uses the device's gyroscope sensor.
android.software.sip — SIP VoIP类.
android.software.sip.voip — 使用基于 SIP的 VoIP 服务.
android.hardware.
touchscreen.multitouch.jazzhand — 增强的
多点触控类,可以实现跟踪5个或更多的点.