Android applications are all written in Java. The Android SDK tool will compile the code into an Android package based on relevant data and resource files, and also describe the .apk documentation. A. APK file is an application and an installation file for android system installation and modification. Once the installation is successful, the application is in its own security sandbox: the Android operating system is a multi-user Linux system, and each application is a different user. By default, the system assigns a Linux User ID to each application (this ID can only be perceived by the system, but not by the application ). The system sets access permissions for all files in the program so that only users with the same user ID and program ID can access these files. Every process has its own virtual machine, so the code running of each program is separated from other programs. By default, each program runs in its own Linux Process. The Android system starts the process when any part of the program needs to be executed, and closes the process when it is not needed or when the system needs to recover memory for other programs. Therefore, the Android system follows the minimum permission principle. That is to say, by default, each application can only access the components required for its own work, rather than other components. This creates a very secure environment where applications cannot access unauthorized system components. However, the system provides a way for multiple applications to share data and access system devices through programs: You can specify the same Linux User ID for the two applications, the two applications can access each other's files. To save system resources, applications with the same user ID can run in the same Linux Process and share the same VM (applications must have the same authentication ). Applications can request the user's permission to access device data such as the user's address book, SMS, SD card, camera, and Bluetooth. These licenses must be confirmed by the user when the application is installed. The basic knowledge of how an application exists in the system is described above. The rest of this document will introduce the core framework components in the application. Application configuration file (manifest file ). It is the place where the program parts and required device features are declared. Resources. It is separated from the program code, so that the program can run well on various configuration devices. Application Components ---------------------------------------------------------------------------- application components are an important part of Android programs. Each component is an entry point for the system to enter the application. Not all components are intended to allow users to access the program. Some components are mutually dependent. However, each component exists as an independent entity and plays a specific role. Each component is a component of a unique application, help us to define the behavior of the entire application. Android applications have four different types of components. Each type of component has a unique design purpose and lifecycle. The lifecycle defines how parts are created and destroyed. The following are the four application components: An activity in a Activities activity represents a "screen" with a user interface ". For example, an email program may use an Activity to display the email list, use another Activity to write emails, and use another Activity to read emails. Although these activities work together in applications to achieve a good user experience, they are independent of each other. In this way, the application can start any activity at any time. For example, the camera program can start activities in the email program to edit new emails to share photos. Activity is implemented as a derivative of the Activity class. You can view more information about Activities in the developer guide. A Service component is a component that runs in the background for a long time or is working for a remote process. A service does not provide user interfaces. For example, a service can be used to play background music. At this time, the user may be using another application, or a service can be used to obtain data from the network without suspending interaction between users and activities. Activity can start the service and run it, or bind it to interact with it. A Service is implemented as a derived class of Service. Refer to the developer guide.