【正文】
an address directly within an application. Support for locationbased services (such as GPS) and accelerometers is also available in the Android software stack, though not all Android devices are equipped with the required hardware. There is also camera support. Historically, two areas where mobile applications have struggled to keep pace with their desktop counterparts are graphics/media, and data storage methods. Android addresses the graphics challenge with builtin support for 2D and 3D graphics, including the OpenGL library. The datastorage burden is eased because 外文資料原文 23 the Android platform includes the popular open source SQLite database. Figure 1 shows a simplified view of the Android software layers. Figure 1. Android software layers Application architecture As mentioned, Android runs atop a Linux kernel. Android applications are written in the Java programming language, and they run within a virtual machine (VM). It39。s important to note that the VM is not a JVM as you might expect, but is the Dalvik Virtual Machine, an open source technology. Each Android application runs within an instance of the Dalvik VM, which in turn resides within a Linuxkernel managed process, as shown below. XXXXXXX 本科畢業(yè)設(shè) 計(jì)論文 24 Figure 2. Dalvik VM An Android application consists of one or more of the following classifications: Activities An application that has a visible UI is implemented with an activity. When a user selects an application from the home screen or application launcher, an activity is started. Services A service should be used for any application that needs to persist for a long time, such as a work monitor or updatechecking application. Content providers You can think of content providers as a database server. A content provider39。s job is to manage access to persisted data, such as a SQLite database. If your application is very simple, you might not necessarily create a content provider. If you39。re building a larger application, or one that makes data available to multiple activities or applications, a content provider is the means of accessing your data. Broadcast receivers An Android application may be launched to process a element of data or respond to an event, such as the receipt of a text message. An Android application, along with a file called , is deployed to a device. contains the necessary configuration information to properly install it to the device. It includes the required class names and types of events the application is able to process, and the required permissions 外文資料原文 25 the application needs to run. For example, if an application requires access to the work — to download a file, for example — this permission must be explicitly stated in the manifest file. Many applications may have this specific permission enabled. Such declarative security helps reduce the likelihood that a rogue application can cause damage on your device. The next section discusses the development environment required to build an Android application. Required tools The easiest way to start developing Android applications is to download the Android SDK and the Eclipse IDE. Android development can take place on Microsoft174。 Windows174。, Mac OS X, or Linux. This article assumes you are using the Eclipse IDE and the Android Developer Tools plugin for Eclipse. Android applications are written in the Java language, but piled and executed in the Dalvik VM (a nonJava virtual machine). Coding in the Java language within Eclipse is very intuitive。 Eclipse provides a rich Java environment, including contextsensitive help and code suggestion hints. Once your Java code is piled cleanly, the Android Developer Tools make sure the application is packaged properly, including the file. It39。s possible to develop Android applications without Eclipse and the Android Developer Tools plugin, but you would need to know your way around the Android SDK. The Android SDK is distributed as a ZIP file that unpacks to a directory on your hard drive. Since there have been several SDK updates, it is remended that you keep your development environment well anized so you can easily switch between SDK installations. The SDK includes: Java archive file containing all of the Android SDK classes necessary to build your application. and docs directory The SDK documentation is provided locally and on the Web. It39。s largely in the form of JavaDocs, making it easy to navigate the many packages in the SDK. The documentation also includes a highlevel Development Guide and links to the broader Android munity. Samples directory XXXXXXX 本科畢業(yè)設(shè) 計(jì)論文 26 The samples subdirectory contains full source code for a variety of applications, including ApiDemo, which exercises many APIs. The sample application is a great place to explore when starting Android application development. Tools directory Contains all of the mandline tools to build Android applications. The most monly employed and useful tool is the adb utility (Android Debug Bridge). USB driver Directory containing the necessary drivers to connect the development environment to an Androidenabled device, such as the G1 or the Android Dev 1 unlocked development phone. These files are only required for developers using the Windows platform. Android applications may be run on a real device or on the Android Emulator, which ships with the Android SDK. Summary: Android is a plete operating environment based upon the Linux174。 kernel. Initially, the deployment target for Android was the mobilephone arena, including smart phones and lowercost flipphone devices. However, Android39。s full range of puting services and rich functional support have the potential to extend beyond the mobilephone market. Android can be useful for other platforms