Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1137025
  • 博文数量: 276
  • 博客积分: 8317
  • 博客等级: 少将
  • 技术积分: 2329
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-12 08:17
个人简介

http://ads.buzzcity.net/adpage.php?partnerid=40096

文章分类

全部博文(276)

文章存档

2013年(1)

2012年(38)

2011年(102)

2010年(85)

2009年(45)

2008年(5)

分类: LINUX

2009-10-29 13:45:30

google前两天发布了Android 2.0, Release 1的sdk,详见


Android 2.0 is a major platform release deployable to Android-powered handsets starting in November 2009. The release includes new features for users and developers, as well as changes in the Android framework API.

For developers, the Android 2.0 platform is available as a downloadable component for the Android SDK. The downloadable platform includes a fully compliant Android library and system image, as well as a set of emulator skins, sample applications, and more. The downloadable platform is fully compliant and includes no external libraries.

To get started developing or testing against the Android 2.0 platform, use the Android SDK and AVD Manager tool to download the platform into your Android 1.6 or later SDK. For more information, see .


Platform Highlights

For a list of new user features and platform highlights, see the Android 2.0 Platform Highlights document.

Built-in Applications

The system image included in the downloadable platform provides these built-in applications:

  • Alarm Clock
  • Browser
  • Calculator
  • Camcorder
  • Camera
  • Contacts
  • Custom Locale (developer app)
  • Dev Tools (developer app)
  • Dialer
  • Email
  • Gallery
  • Gestures Builder
  • IME for Japanese text input
  • Messaging
  • Music
  • Settings
  • Spare Parts (developer app)

Locales

The system image included in the downloadable platform provides a variety of built-in locales. In some cases, region-specific strings are available for the locales. In other cases, a default version of the language is used. The languages that are available in the Android 2.0 system image are listed below (with language_country/region locale descriptor).

  • Chinese, PRC (zh_CN)
  • Chinese, Taiwan (zh_TW)
  • Czech (cs_CZ)
  • Dutch, Netherlands (nl_NL)
  • Dutch, Belgium (nl_BE)
  • English, US (en_US)
  • English, Britain (en_GB)
  • English, Canada (en_CA)
  • English, Australia (en_AU)
  • English, New Zealand (en_NZ)
  • English, Singapore(en_SG)
  • French, France (fr_FR)
  • French, Belgium (fr_BE)
  • French, Canada (fr_CA)
  • French, Switzerland (fr_CH)
  • German, Germany (de_DE)
  • German, Austria (de_AT)
  • German, Switzerland (de_CH)
  • German, Liechtenstein (de_LI)
  • Italian, Italy (it_IT)
  • Italian, Switzerland (it_CH)
  • Japanese (ja_JP)
  • Korean (ko_KR)
  • Polish (pl_PL)
  • Russian (ru_RU)
  • Spanish (es_ES)
  • Localized UI strings match the locales that are accessible through Settings.

    Emulator Skins

    The downloadable platform includes a set of emulator skins that you can use for modeling your application in different screen sizes and resolutions. The emulator skins are:

    • QVGA (240x320, low density, small screen)
    • WQVGA (240x400, low density, normal screen)
    • FWQVGA (240x432, low density, normal screen)
    • HVGA (320x480, medium density, normal screen)
    • WVGA800 (480x800, high density, normal screen)
    • WVGA854 (480x854 high density, normal screen)

    For more information about how to develop an application that displays and functions properly on all Android-powered devices, see .

    Developer Features

    The sections below provide information about new developer features offered by the downloadable Android 2.0 platform component.

    Ant Support

    • Debug- and release-mode application signing. Release-mode signing includes integrated support for zipalign optimization. For more information, see .
    • Adds new Ant build system with support for Emma instrumentation projects (code coverage).

    Framework API

    The sections below provide information about the application framework API provided by the Android 2.0 platform.

    API level

    The Android 2.0 platform delivers an updated version of the framework API. As with previous versions, the Android 2.0 API is assigned an integer identifier — 5 — that is stored in the system itself. This identifier, called the "API Level", allows the system to correctly determine whether an application is compatible with the system, prior to installing the application.

    To use APIs introduced in Android 2.0 in your application, you need to set the proper value, "5", in the attributes of the element in your application's manifest.

    For more information about how to use API Level, see the document.

    API changes summary

    Bluetooth

    • Turn on/off Bluetooth
    • Device and service discovery
    • Connect to a remote device using RFCOMM and send/receive data
    • Advertise RFCOMM services and listen for incoming RFCOMM connection

    Sync adapters

    • New APIs for sync adapters to connect to any backend

    Account Manager

    • Centralized account manager API to securely store and access auth tokens/passwords

    Contacts

    • New contacts APIs that allow for data from multiple accounts
    • New Quick Contact framework APIs enable developers to create contact badges in their app. Clicking on the badge opens a window with a list of ways to contact the person with one click.

    WebView

    • Deprecated classes: UrlInterceptHandler, Plugin, PluginData, PluginList, UrlInterceptRegistry.

    Camera

    • New parameters for color effect, scene mode, flash mode, focus mode, white balance, rotation, and other settings.
    • New ZoomCallback interface to perform actions when the zoom level has changed.

    Media

    • MediaScanner now generates thumbnails for all images when they are inserted into MediaStore.
    • New Thumbnail API for retrieving image and video thumbnails on demand.

    Other Framework

    • New system themes in android.R.style to easily display activities on top of the current system wallpaper or keep the previous activity visible in the background.
    • New WallpaperManager API replaces and extends the wallpaper APIs that were previously in Context, to allow applications to request and set the system wallpaper.
    • New Service APIs to help applications correctly handle Service life-cycle, in particular low memory situations where a Service may be killed while it is running.
      • Service.setForeground() has been deprecated and now effectively performs no operation. This is replaced with a new API, startForeground(), that helps (and requires) associating an ongoing notification with the foreground state.
    • MotionEvent can now report simultaneous-touch information for devices that support it. Up to three pointers can be tracked simultaneously.
    • KeyEvent has new key dispatching APIs, to help implement action-on-up and long press behavior, as well a new mechanism to cancel key presses (for virtual keys).
    • WindowManager.LayoutParams has new constants that allow a window to wake up the screen when it is displayed and show the window even if the screen is locked. This allows applications to more cleanly implement things like alarm clocks that should wake the device.
    • New Intent APIs that broadcast the docking state of the device and allow applications to launch special activities when the device is placed in a desktop or car dock.

    Key events executed on key-up

    Android 2.0 is designed to run on devices that use virtual keys for HOME, MENU, BACK, and SEARCH, rather than physical keys. To support the best user experience on those devices, the Android platform now executes these buttons at key-up, for a key-down/key-up pair, rather than key-down. This helps prevent accidental button events and lets the user press the button area and then drag out of it without generating an event.

    This change in behavior should only affect your application if it is intercepting button events and taking an action on key-down, rather than on key-up. Especially if your application is intercepting the BACK key, you should make sure that your application is handling the key events properly.

    In general, intercepting the BACK key in an application is not recommended, however, if your application is doing so and it invokes some action on key-down, rather than key-up, you should modify your code.

    If your application will use APIs introduced in Android 2.0 (API Level 5), you can take advantage of new APIs for managing key-event pairs:

    • If you are intercepting the BACK key in an activity or dialog, just implement the new method.
    • If you are intercepting the BACK key in a view, you should track the key event on key-down (through the new method), then invoke the action at key up. Here's a pattern you can use:
    •     public boolean onKeyDown(int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_BACK
      && event.getRepeatCount() == 0) {
      event.startTracking();
      return true;
      }
      return super.onKeyDown(keyCode, event);
      }

      public boolean onKeyUp(int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
      && !event.isCanceled()) {
      // *** DO ACTION HERE ***
      return true;
      }
      return super.onKeyUp(keyCode, event);
      }

    If you want to update a legacy application so that its handling of the BACK key works properly for both Android 2.0 and older platform versions, you can use an approach similar to that shown above. Your code can catch the target button event on key-down, set a flag to track the key event, and then also catch the event on key-up, executing the desired action if the tracking flag is set. You'll also want to watch for focus changes and clear the tracking flag when gaining/losing focus.

    API differences report

    For a detailed view of API changes in Android 2.0 (API Level 5), as compared to the previous version, see the .


    阅读(1041) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~