Android cainiao: parse basic principles of applications

Source: Internet
Author: User
Tags least privilege

Application basics-Application Fundamentals

Android applications use java as the development language. With the tools provided by the Android SDK, You can package the data and resource files stored in the application to an Android package. This file uses .apk as the extension. All codes are in a single. APK file. As an application, this file is usually installed on Android devices.

Once installed on a device, each application will survive in its own security sandbox.

  • An Android system is a multi-user Linux system, and each application is a different user.
  • By default, the system assigns an independent Linux User ID to each application (this ID is used only by the system and is used as unknown ), the system sets permissions for all files in an application, so only applications with the user ID assigned can access them.
  • Each process has its own virtual machine, so the running of an application code is isolated from the running of other application code.
  • By default, each application runs in its own Linux Process. When any code in the application starts to run, Android starts a process. When other applications no longer need system resources, it is disabled.

In this way, the Android system implements the principle of least privilege. By default, each application only accesses components that require work, and does not do anything else. In this way, a very secure environment is created, and applications cannot access other parts that are not authorized by the system.

However, applications can share data with other applications and access system services in multiple ways:

  • It is possible that two applications share a linux User ID, in which case they can access each other's data. To save system resources, applications with the same user ID may also be scheduled to run in the same Linux Process and share the same VM (the application must be signed for the same authentication ).
  • All applications can request access to hardware data, such as user communication records, SMS messages, mounted storage devices (SD cards), cameras, and Bluetooth, permissions for all applications must be granted to the user during installation.

The following section describes how an application exists in a system:

  • Define core framework components in your application
  • In manifest, declare the request for components and device features for your application.
  • Resources independent from application code can greatly optimize the performance of your application on various configuration devices.
Application Component-Application Components

Application components are the key and cornerstone for building Android applications. Each component is a different entry point from which the system can enter your application. For users, not every component is an actual entry point, but there are some dependencies between them. however, each existing component has its own entry point and plays a specific role. Each component is a unique building block that helps you define the overall behavior of your application.

There are four different types of application components, each of which serves a different purpose and has a different life cycle, which defines how to create and destroy it.

The following are four application components:

Activities
  • An activity is displayed on a screen as a user interface. for example, an email application may have an activity, which is used to display a new email list. another activity is used to write emails, and another activity is used to read emails. although these activities work together in the e-mail application to form a complete user experience, each part is independent of each other. because of this, different applications can start any of these activities (for example, an email application allows it ). for example, a photo application can enable a new email writing activity in an email application to allow users to share a photo.
  • An activity is implemented as a subclass of the Activity. In the Activities Development Guide, you can learn
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.