About Android Service

Source: Internet
Author: User

About Android Service
What is Service?

· Service indicates "Service ".
· Service is one of the core components of the Android system.
-Service is essentially a Java class that inherits android. app. Service.
-Each Service should be registered in the AndroidManifest. xml file;
-The Service is maintained by the Android system.

Service Positioning

 

· The Service does not have a matched user interface, which is usually used for background processing time-consuming operations.
· Time-consuming operations cannot be performed in the main thread. ,
· The Service is running in the main thread;
· Although the Service is positioned as "processing time-consuming operations", various time-consuming operations must be performed in
In Service.
· Components can be bound to the Service to implement Inter-Process Communication (IPC: Inter Process Communication)
Process Priority
· The Android system tries to maintain as many processes as possible, but due to limited device performance, in the process of dynamic memory management,

Android often terminates low-priority processes to release resources and ensure normal operation of high-priority processes.

 

Process priorities are classified as follows (from high to low ):

1. Foreground Process (Foreground Process)
(1) There is an Activity that is interacting with the user;
(2) A Service exists, and the Service is bound to the Activity that interacts with the user;
(3) The startForeground () of the Service is called.
(4) There is a Service that is executing the core lifecycle method. Including: onCreate (), onSrart ()
, Onsrartcommandroid (); onDestroy ();
(5) A broadcast receiver is receiving the broadcast.
2. Visible Process)
There are no front-end components, but they contain user-visible components, such:
(1) A paused Activity
(2) A Service bound to a visible Activity exists.
3. Service Process)
(1) The Service is started using startService (), but the Service is not raised to the "front-end", "visible"
"Level
4. Background Process)
Most of them are activities after onStop ().
5. Empty Process)
Processes that do not contain any active components. To facilitate caching of components and improve the efficiency of the next startup, the system may temporarily retain
They

Note: only the first three processes that contain services



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.