Fundamentals of Application

Source: Internet
Author: User

Article Address: https://developer.android.com/guide/components/fundamentals.html

Once installed on the device, each app will live in its own security sandbox.

1, the Android operating system is a multi-user Linux system, each application is a different user

2, by default, the system will assign each application a unique Linux User ID (this ID can only be used by the system, for the application is not known). The file system used in an app will set permissions. There are apps assigned the corresponding user ID to access them.

3. Each process has its own virtual machine, so the application code is in a space where other application isolation is run.

4. By default, each app runs in its own Linux process. As long as any component in the app is executed, Android will start the process, and if they no longer need it or if they want to recover memory for other applications then the process will be closed.

However, there is a need for a way for an application to share data and access system services with other applications.

1, you can arrange two apps to share the same Linux user ID, so that they can access each other's files. In order to maintain system resources, applications with the same user ID are also scheduled to run in the same Linux process and share the same virtual machines (these applications must be registered with the same signature).

2, an application can request permission to access device data such as contacts, SMS and so on. All app permissions must be set when the user installs.


There are 4 of unused types of application components. Each type provides different purposes, how components with different life cycle definitions are created and destroyed.

1, activities

2. Services

3. Content providers, a content provider manages a group of shared application data. You can store this data in a system file, in a database, on the web, or in a place where your app can access persistent storage. With content provider, other apps can query and even modify data.

4, Boradcast Receivers

There are separate ways to activate each type of component

1. Call StartActivity () or Startactivityforresult () method by passing intent

2. Call StartService () or Bindservice () method by passing intent

3. You can define a broadcast call Sendbroadcast (), Sendorderedbroadcast (), or sendstickybroadcast () via intent.

4. You can execute a query to content provider by calling Contentresolver's query ().


Before the Android system launches an application component, it must be known that they exist by reading the app's manifest file. You have to make this file declare all the components. By defining the Element (<activity>,<service>,<receiver>,<provider>) in the manifest file.

Activities, services, and content providers must be declared in manifest or the system will not be visible and cannot be run. However, broadcast receivers can be dynamically created in code, in addition to manifest, by calling the Registerreceiver () method.

Declared function if the device is not supported, the app will not install, you can declare this feature but do not request it, but you must set required to false, which ensures that the functionality is available in the running environment, but does not use them.

<uses-featureandroid:name="Android.hardware.camera.any"
android:required = "false" />





Fundamentals of Application

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.