开发者

Android: How does Application class work with remote processes?

开发者 https://www.devze.com 2023-03-24 16:23 出处:网络
Say that my app implements a subclass of Application has 2 different ser开发者_Python百科vices running different processes.

Say that my app implements a subclass of Application has 2 different ser开发者_Python百科vices running different processes.

What happens if I call getApplication() in each Service? Will I get back 2 completely independent instances, 1 for each process?

If so, then will the 2 instances be somehow linked? In other words, would modifications made to the instance in one process show up in the instance made in the other?


Say that my app implements a subclass of Application has 2 different services running different processes.

99.9999% of Android applications do not need this, and it wastes RAM, CPU, and battery.

Will I get back 2 completely independent instances, 1 for each process?

Of course. They are different processes.

If so, then will the 2 instances be somehow linked?

No.

0

精彩评论

暂无评论...
验证码 换一张
取 消