当前位置: 代码迷 >> Android >> Professional Android 二 Development - 9
  详细解决方案

Professional Android 二 Development - 9

热度:226   发布时间:2016-05-01 14:30:38.0
Professional Android 2 Development - 9
ANDROID SDK FEATURES
ANDROID SDK的诸多特性


The true appeal  of Android as a development environment lies  in the APIs it provides.
As an application-neutral  platform, Android gives you the opportunity to create applications that are as much a part of the phone as anything provided out of the box. The following list highlights some of the most noteworthy  Android features:

Android作为一个开发环境真正的感染力在它提供的诸多API中。作为一个中立的应用平台,Android给你机会来开发好比手机本身自带功能的应用程序。下面的列表是Android诸多特性中部分值得关注的:

? No licensing, distribution, or development fees or release approval processes
? 没有许可、分法或开发费用或发布审核程序

? Wi-Fi hardware access
? 访问Wi-Fi 硬件
? GSM, EDGE, and 3G networks for telephony or data transfer, enabling you to make or receive calls or SMS messages, or to send and retrieve data across mobile networks
? 用于电话或数据传输的GSM,EDGE和3G网,让你可以拨出或接听电话或短信,或通过移动网络发送接收数据。
? Comprehensive  APIs for location-based services such as GPS
? 提供诸如GPS的地理位置服务的广泛的API
? Full multimedia hardware control, including playback and recording with the camera and microphone
? 完整的多媒体硬件控制,包括回放、照相机和麦克风。
? APIs for using sensor hardware, including accelerometers and the compass
? 使用传感器设备的API,包括加速器和指南针
? Libraries for using Bluetooth for peer-to-peer data transfer
? 用蓝牙进行点对点数据传输的库
? IPC message passing
? IPC消息传递
? Shared data stores
? 数据共享
? Background applications and processes
? 后台应用和进程
? Home-screen Widgets, Live Folders, and LiveWallpaper
? 主屏幕的Widget控件,活动夹和活动壁纸
? The ability to integrate  application search results into the system search
? 将应用搜索结果整合进系统搜索的能力
? An integrated open-source HTML5WebKit-based browser
? 集成开源的基于HTML5Web-Kit的浏览器
? Full support for applications that integrate map controls as part of their user interface
? 将地图控制集成为应用的用户界面的完整支持
? Mobile-optimized hardware-accelerated graphics, including a path-based 2D graphics library
and support for 3D graphics using OpenGL ES 2.0
? 手机图像硬件加速,包括基于2维的图像库及使用OpenGL ES 2.0支持3维图像
? Media libraries for playing and recording a variety of audio/video or still image formats
? 用于游戏、记录多种音频、视频或图像格式的多媒体库
? Localization through a dynamic resource framework
? 通过一个动态资源框架提供的定位服务
? An application framework that encourages  reuse of application components and the replacement of native applications
? 一个鼓励复用应用组件且作为本地应用替代品的应用框架

Access to Hardware, Including Camera, GPS, and Accelerometer
访问硬件,包括照相机,GPS和加速器


Android includes API libraries to simplify development involving the device hardware. These ensure that you don’t need to create specific implementations of your software for different devices, so you can create Android applications that work as expected on any device that supports the Android software stack.
Android的API库简化了涉及硬件设备的开发。这确保你不需要为不同的设备上的软件创建特殊的实现,在Android软件体系的支撑下你可以创建运行在任何设备下的Android应用。

The Android SDK includes APIs for location-based hardware (such as GPS), the camera, audio, network connections, Wi-Fi, Bluetooth, accelerometers, the touchscreen, and power management. You can explore the possibilities of some of Android’s hardware APIs in more detail in Chapters 11 through 14.

Android SDK API涉及了定位硬件(例如GPS),照相机,音频,网络链接,Wi-Fi,蓝牙,加速器,触摸屏和电量管理器。你可以在第11到14章中更详细地浏览一些优秀的Android的硬件API。

Native Google Maps, Geocoding , and Location-Based Services
本地Google地图,地理编码和定位服务

Native map support lets you create a range of map-based applications that leverage the mobility of Android devices.
本地地图支持你利用Android设备的移动性来创建一个基于地图范围的应用。

Android lets you create activities that include interactive Google Maps as part of your user interface, with full access to maps that you can control programmatically and annotate using Android’s rich graphics library.
Android可以让你创建将交互式谷歌地图包含进用户界面的activity,你可以通过使用Android的富图像库进行编程和注释全面控制地图。

Android’s location-based services manage technologies like GPS and Google’s GSM cell-based location technology to determine the device’s current position. These services enforce  an abstraction from specific location-detecting  technology and let you specify  minimum requirements (e.g., accuracy or cost) rather than choosing a particular technology.
Android的定位服务管理技术比如GPS和谷歌的GSM通过网格定位技术来确定设备当前位置。这些服务通过执行来自位置探测技术的提取来让你指定最小需要(比如精度或费用)而不是选择一种特别的技术。

They also mean that your location-based applications will work no matter what technology the host handset supports.
这就意味着你的基于定位的应用程序不用关心什么技术在宿主硬件对程序的支持。

To combine maps with locations, Android includes an API for forward  and reverse  geocoding that lets you find map coordinates  for an address, and the address of a map position. You’ll learn the details of using maps, the Geocoder, and location-based services in Chapter 8.

为了将地图与定位关联,Android包含了一个用于转发和倒转地理编码的API,这个API可以让你找到地址在地图上的坐标和地图上的位置。在第8章中,你将学习使用地图的细节,有地理编码、定位服务等。

Background Services
后台服务


Android supports applications and services designed to run invisibly in the background.
Android设计上支持应用程序和服务以不可见方式在后台运行。

Modern mobiles are by nature  multifunction devices; however, their limited screen sizes means that generally only one interactive application can be visible at any time.

现代手机天生就是多功能设备;然后,受屏幕大小的限制,在任何时候通常只有一个交互应用可见。

Platforms that don’t support background execution limit the viability of applications that don’t need your constant attention.
平台不支持后台执行在不需要你经常的关注下限制应用程序的存在。

Background services make it possible to  create invisible application components that perform automatic processing without direct user action.
后台服务使创建能够不用用户直接动手而执行自动处理的不可见的应用组件成为可能。

Background execution allows your applications to become event driven and to support regular updates, which is perfect  for monitoring game scores or market prices, generating  location-based alerts, or prioritizing  and prescreening incoming calls and SMS messages.
后台执行允许你的应用由事件驱动并支持定期更新,比如准确地监控游戏分数或市场价格,生成定位警告,或优先显示电话拨入和短信息。

Learn more about how to get the most out of background services in Chapter 9.

在第9章可以学到更多关于后台服务的内容。

SQLite Database for Data Storage and Retrieval
用于数据存储和检索的SQLite数据库


Rapid and efficient data storage and retrieval are essential for a device whose storage capacity  is limited by its compact  nature.
快速有效的数据存储和检索是那些存储能力受自身约束的设备的基本要素。

Android provides a lightweight relational database for each application using SQLite. Your applications can take advantage of this managed relational database engine to store data securely and efficiently.
Android使用SQLite为每个应用程序提供一个轻量级关系数据库。你的应用可以利用这个托管的关系型数据库引擎安全有效地存储数据。

By default each application database is sandboxed — its content is available only to the application that created it — but Content Providers supply  a mechanism for the managed sharing of these application databases.

每个应用的数据库默认情况下是沙盒的,它的内容是只能被创建数据的应用使用,但是Content Provider提供了一种机制以托管共享这些应用的数据库。

Databases and Content Providers are covered in detail in Chapter 7.
第7章会告诉你数据库和Content Provider的细节。

Shared Data and Interapplication Communication
数据共享和跨应用通信


Android includes three techniques  for transmitting information from your applications for use elsewhere: Notifications, Intents, and Content Providers. Notifications are the standard means by which a mobile device traditionally alerts users. Using the API you can trigger audible  alerts, cause vibration , and flash the device’s LED, as well as control status bar notification icons, as shown in Chapter 9.
Android包括三种数据传送技术,供你的应用传送信息到别处。Notification,Intent和Content Provider。Notification可以触发警报声,振动,和擦写设备的LED,控制状态栏的通知图片,这些会在第9章中写到。

Intents provide a mechanism for message-passing within and between applications. Using Intents you can broadcast  a desired  action (such as dialing  the phone or editing a contact) system-wide for other applications to handle. Intents are an important core component of Android and are covered in depth in Chapter 5.
Intent提供了一个在应用程序之间传递消息的机制。使用Intent你可以在系统范围内向其他应用程序播送你渴望的动作(例如拨电话或编辑联系人)。Intent是Android一个重要的核心组件,将在第5章中深入讲述。

Finally, you can use Content Providers to give managed access to your application’s private databases. The data stores for native applications, such as the contact manager, are exposed as Content Providers so you can create your own applications that read or modify this data. Chapter 7 covers Content Providers in detail, including the native providers, and demonstrates how to create and use providers of your own.
最后,你可以使用Content Provider 访问你的应用私有的数据库。本地应用的数据存储,比如联系人管理,都由Content Provider提供,因此你可以创建自己的应用程序来读取或修改这些数据。第7章会详细讲述Content Provider,包括本地提供者,并展示如何创建及使用你自己的提供者。

Using Widgets, Live Folders, and Live Wallpaper to Enhance the
Home Screen
使用Widget控件,活动夹和活动壁纸来增强主屏


Widgets, Live Folders, and Live Wallpaper let you create dynamic application components that provide a window into your applications or offer useful and timely information directly on the home screen.
Widget控件,活动夹和活动壁纸让你创建动态应用组件,比如在你的应用中做出一个窗口或直接在主屏上提供可用的及时的信息。

If you offer a way for users to interact with your application directly from the home screen, they get instant  access to interesting information without needing to open an application, and you get a dynamic shortcut into your application.
如果你为使用提供一个途径在主屏上直接和你的应用交互,而你在你的应用中放置一个动态的捷径,他们就可以不需要打开另一个应用就能立即获得感兴趣的信息。

You’ll learn how to create application components for the home screen in Chapter 10.
你将在第10章中学习如何为主屏创建应用组件。

Extensive  Media Support and 2D/3D Graphics
广泛的媒体支持和2D/3D图像


Bigger screens and brighter , higher-resolution displays have helped make mobiles multimedia devices.
更大的屏幕和更亮、更高的显示分辨率正在促进移动多媒体设备。

To help you make the most of the hardware available, Android provides graphics libraries for 2D canvas drawing and 3D graphics with OpenGL.

为了帮助你最大限度地利用硬件,Android提供用于画2维图像的图像库和使用OpenGL的3维图像。

Android also offers comprehensive  libraries for handling still  images, video, and audio files, including the MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, and GIF formats.2D and 3D graphics are covered in depth in Chapter 15, while Android media management libraries are covered in Chapter 11.
Android也提供综合的类库用来操作静止图片,视频和音频文件,包括MPEG4,H.264,MP3,AAC,JPG, PNG, 和 GIF格式。2维和3维图形在第5章中深入讲述,而第11章讲述媒体管理库。

Optimized Memory and Process Management
优化的内存和进程管理


Android’s process and memory management is a little unusual . Like Java and .NET, Android uses its own run time and virtual machine to manage application memory.
Android的进程和内存管理是小巧的与众不同的。像Java和.NET,Android用它自己的运行时和虚拟机来管理应用的内存。

Unlike with either of these other frameworks, the Android run time also manages the process lifetimes . Android ensures application responsiveness  by stopping and killing processes as necessary to free resources for higher-priority  applications.
不像这些其他框架,Android运行时也管理进程的生命周期。Android确保必要的时候停止、杀死进程时应用能够响应,为高优先的应用释放资源。

In this context, the highest priority is given to the application with which the user is interacting. Ensuring that your applications are prepared for a swift  death but are still able to remain responsive, and to update or restart in the background if necessary, is an important consideration in an environment that does not allow applications to control their own lifetimes.
You will learn more about the Android application life cycle in Chapter 3.

在这个上下文中,应用在用户交互时获得最高优先权。确保应用准备好迅速地死去,但仍然能够保留响应,并能在必需时在后台更新或重启,是一个不允许应用控制自己生命周期的环境中重要的考虑。你将在第3章学习更多关于Android应用生命周期的知识。

INTRODUCING THE OPEN HANDSET ALLIANCE
关于开放硬件联盟的介绍


The Open Handset Alliance (OHA) is a collection of more than 50 technology companies, including hardware manufacturers, mobile carriers, and software developers. Of particular  note are the prominent  mobile technology companies Motorola, HTC, T-Mobile, and Qualcomm. In their own words, the OHA represents the following:
开放硬件联盟(OHA)是一个超过50家公司组成的集合,包括硬件制造商,运行商,软件开发商。需要特别说明的突出的手机公司是摩托罗拉,HTC,T-Mobile和Qualcomm。按他们自己的说法,开放手机联盟是:

A commitment  to openness, a shared vision for the future, and concrete  plans to make the vision a reality. To accelerate  innovation in mobile and offer
consumers a richer, less expensive, and better mobile experience . (http://www
.openhandsetalliance.com/)

一个公开的承诺,一个共享的未来美景,和具体的实现美景的计划。为了加快手机创新和提供给客户一个更丰富的,便宜的,更好的手机体验。(http://www.openhandsetalliance.com/)

The OHA hopes to deliver  a better mobile software experience for consumers by providing the platform needed for innovative mobile development at a faster rate and with higher quality than existing platforms, without licensing fees for either software developers or handset manufacturers.
开放手机联盟希望通过提供平台所需要的,以更快速、高质量来开发新的手机产品,交付给客户一个比已存在的平台更好的手机软件体验,对任意软件开发者或硬件制造商都不需要许可费。
  相关解决方案