0

I found service in separate process invoked its onCreate method in 'main thread', but this 'main thread' is different with the application's main thread(compare by == operator), I've log the life cycle of the application and service, the onCreate method in application invoked twice in two different process, but the onCreate method in service invoked once. Does this means the android dvm create two 'main thread' in two process?

Mr.icefox
  • 41
  • 1
  • 5
  • 1
    each process has its own main thread, so if you have two processes there are also two main threads – pskink Mar 10 '16 at 08:28
  • @pskink thank you, so the application be created twice is right?Every application with component in separate process should create twice in different process? – Mr.icefox Mar 10 '16 at 10:50
  • twice or more times, depends on numbers of processes, but honestly: what do you need separate processes for? – pskink Mar 10 '16 at 10:51
  • @pskink thanks, I just fork and add some function with the Leakcanary in github and found there is a HeapAnalyzerService in separate process – Mr.icefox Mar 11 '16 at 04:12

0 Answers0