Binding a Service to an android.app.Activity vs Binding it to an android.app.Application

前端 未结 2 1437
梦谈多话
梦谈多话 2020-12-30 03:44

Is there any fundamental difference in binding a service to an android.app.Activity vs binding it to an android.app.Application. I want to

2条回答
  •  情深已故
    2020-12-30 04:14

    answer of @Jere.Jones is not 100% correct. You have one Instance of Application class per Process. So if you run your service in a seperate Process e.g. with

     
    

    you have two seperate Instances of Appliaction, which means if you need to "hold a state" you must ensure its either not Process crossing, or you have to use IPC to sync these sates.

提交回复
热议问题