Android-Process life cycle

Source: Internet
Author: User

android-process life cycle A process level
is prioritized as follows:
1 active Processes: Active process
The existence period
is in the activity Resume () [Activity restart] State
is in the state that is interacting with the bound service
is in a state where the service is running in the foreground (Setforeground () is called, The function sets the thread that creates the specified window to the foreground and activates the window)
Service lifecycle function is being executed (onCreate (), Onstrat (), Ondestory ())
Broadcast Receiver is executing the Onreceiver () method
killing foreground process requires the user to do so because the security priority is highest
security priority is highest and is not easily killed


2 visible Process: visble Processes
The current process is not the focus process, activity is not displayed at the front
but it is not completely hidden, can be seen, such as a popup dialog


3 service process: Started Services Processes
A running activity process that does not have a service


4 Background process: Backgroud process
Invisible state in either of the two States, and no related service runs (OnStop () is called). The system has a background
process list, which generally takes the principle of last in, first out (queue) to release background process resources


5 Empty processes: Empty process
does not run any components of the process, leaving this process primarily for caching needs, For example, the next time you start this process can be faster


Two Android app startup and extinction process
Start
by Packagemanage (dependent on Packagemanageservice, Also related to the manifest file) begins->start The main activity-> main activity does not exist--zygote system daemon
Instantiates a virtual machine process, load Dex file


Exit
Auto-release

Kernel->dirvers (Driver)->misc->lowmemorykiller.c file (Implementation mechanism) soft drive


3 ways to Exit program code
Finish ();
System.exit (0); violence exits
Process.killprocess (Process.mypid ()); violence exits

Android-Process life cycle

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.