The startup process of the Android service component in the new process

Source: Internet
Author: User

1, StartService

In the Android system anonymous shared memory (Anonymous shared Memories) Java Call Interface analysis, http://blog.csdn.net/jltxgcy/article/details/31414509 article, The client calls the following code:

public class Client extends Activity implements Onclicklistener {public       void OnCreate (Bundle savedinstancestate) {
    ..... StartService (New Intent ("Shy.luo.ashmem.server"));         .....      }..}


Here we analyze the entire process until it is executed:

public class Server extends service {public      void OnCreate () {          log.i (Log_tag, "Create Memory service ...");            Memoryservice = new Memoryservice ();            try {              servicemanager.addservice ("Anonymoussharedmemory", memoryservice);              LOG.I (Log_tag, "Succeed to add memory service.");          catch (RuntimeException ex) {              log.i (Log_tag, "Failed to add Memory Service.");              Ex.printstacktrace ();          }        }    .....}


2, the entire process and the Android Activity component start-up process http://blog.csdn.net/jltxgcy/article/details/35984557, almost consistent. Just Activityrecord replaced with servicerecord,mactivities replaced by Mservices, and less two steps, see:



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.