Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 高級開發 >> Android 2.3 API改變大全

Android 2.3 API改變大全

編輯:高級開發

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 新增 firstInstallTimelastUpdateTime 可以查看一個軟件的安裝和上次更新時間,這比直接獲取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.
  • 新增 takeInputQueuetakeSurface() 讓本地代碼管理一個窗口事件.

有關最新版的NDK下載和NDK參考文檔可以在 android開發包下載 中找到。

有關Dalvik運行時庫

  • dalvik.system 移除了很多類,在上一版本這些類已經標記為將放棄使用包含以下
  • Dalvik 核心庫:
    • 新增 collections: ArrayDeque, NavigableMap, ConcurrentSkipListMap, LinkedBlockingDeque 數據類型
    • 新增 Arrays 輔助方法: binarySearch(), copyOf(), copyOfRange(), and others.
    • 新增CookIEManager針對HttpURLConnection.
    • 更完整的網絡API支持比如 InterfaceAddress, NetworkInterfaceIDN
    • 文件讀寫控制
    • String.isEmpty()
    • NormalizerNormalizer.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個或更多的點.

以上是android 2.3姜餅的API改變大全,有關具體的新增功能實用,Android123將在今後的文章和android進階開發系列教程中逐一介紹。

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved