1、文献、资料来源:文献、资料发表(出版)日期:院 (部): 专 业: 班 级:姓 名:学 号:指导教师:翻译日期: 2017.02.14外文及翻译英语原文Android applications are written in the Java programming language. The Android SDK tools compile the codealong with any data and resource filesinto anAndroid package, an archive file with an.apksuffix. All the code in a sing
2、lefile is considered to be one application and is the file that Android-powered devices use to install the application.Once installed on a device, each Android application lives in its own security sandbox:l The Android operating system is a multi-user Linux system in which each application is a dif
3、ferent user.l By default, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files in an application so that only the user ID assigned to that application can access them.l Each pro
4、cess has its own virtual machine (VM), so an applications code runs in isolation from other applications.l By default, every application runs in its own Linux process. Android starts the process when any of the applications components need to be executed, then shuts down the process when its no long
5、er needed or when the system must recover memory for other applications.In this way, the Android system implements theprinciple of least privilege. That is, each application, by default, has access only to the components that it requires to do its work and no more. This creates a very secure environ
6、ment in which an application cannot access parts of the system for which it is not given permission.However, there are ways for an application to share data with other applications and for an application to access system services:l Its possible to arrange for two applications to share the same Linux
7、 user ID, in which case they are able to access each others files. To conserve system resources, applications with the same user ID can also arrange to run in the same Linux process and share the same VM (the applications must also be signed with the same certificate).l An application can request pe
8、rmission to access device data such as the users contacts, SMS messages, the mountable storage (SD card), camera, Bluetooth, and more. All application permissions must be granted by the user at install time.That covers the basics regarding how an Android application exists within the system. The res
9、t of this document introduces you to:l The core framework components that define your application.l The manifest file in which you declare components and required device features for your application.l Resources that are separate from the application code and allow your application to gracefully opt
10、imize its behavior for a variety of device configurations. Application ComponentsApplication components are the essential building blocks of an Android application. Each component is a different point through which the system can enter your application. Not all components are actual entry points for
11、 the user and some depend on each other, but each one exists as its own entity and plays a specific roleeach one is a unique building block that helps define your applications overall behavior.There are four different types of application components. Each type serves a distinct purpose and has a dis
12、tinct lifecycle that defines how the component is created and destroyed.Here are the four types of application components:ActivitiesAnactivityrepresents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity
13、to compose an email, and another activity for reading emails. Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others. As such, a different application can start any one of these activities (if the email application all
14、ows it). For example, a camera application can start the activity in the email application that composes new mail, in order for the user to share a picture.An activity is implemented as a subclass ofActivityand you can learn more about it in theActivitiesdeveloper guide.ServicesAserviceis a componen
15、t that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it.A service is implemented as a subc
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1