Reputation: 7571
In an effort to keep my services alive, can I have more than one service in foreground?
I am starting two services at once, and I don't want any of them to be destroyed. So, after reading for hours, I found the solution is to return START_STICKY
and use startForeground(...)
on my service. But, I have two services, so can I have them both be in the foreground, and both never be destroyed?
Upvotes: 6
Views: 4985
Reputation: 13957
There are several aspects to consider.
So, as always it depends on what exact you want to achieve ;) But to me it looks like as if you could simply implement two threads in one sticky service - I can't any see disadvantages here.
If your app gets inactivated by any kind of start manager, crash, or force close, your users might have to start the app again (see this post including app states).
Hope this helps!
Upvotes: 6