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: