Android 2.3的API Level为9,有关所有的API改变,Android123帮助大家总结如下:
新增包
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 标记将支持更多的屏幕尺寸, 有关具体的使用方法,Android开发网将在今后的文章中讲到。.
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_ALARM 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 核心库:
新增 collections: ArrayDeque, NavigableMap, ConcurrentSkipListMap, LinkedBlockingDeque 数据类型
新增 Arrays 辅助方法: binarySearch(), copyOf(), copyOfRange(), and others.
新增CookieManager针对HttpURLConnection.
更完整的网络API支持比如 InterfaceAddress, NetworkInterface 和 IDN
文件读写控制
String.isEmpty()
Normalizer 和 Normalizer.Form
改进了 javax.net.ssl server sockets.
新增manifest元素和属性
新增 xlargeScreens 属性针对 <supports-screens> 元素,可以支持更大设备比如说Android平板的定义。
新的屏幕方向属性 android:screenOrientation 在<activity> 中
"reverseLandscape" — The Activity would like to have the screen in landscape orientation, turned in the opposite direction from normal landscape.
"reversePortait" — The Activity would like to have the screen in portrait orientation, turned in the opposite direction from normal portrait.
"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.
"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.
"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个或更多的点.