Reputation: 6539
I am designing an app that will have some activities separated in tabs. Some of them will have to perform tasks in the background will the user is in another tab.
What is the best strategy for designing an app like this?
I was thinking about using a service but it can be killed by android dalvik, isnt it?
Thanks in advance!
Upvotes: 0
Views: 455
Reputation: 27421
Like Cristian Said, anything could be killed, especially when they are inactivated.
But I think the best bet for doing background stuff would still be the service, and as long as your user is still on one of your activity, it is very less likely to be killed (unless under really extreme conditions) You might bind the service with your Application
, so that you can have better control even if it's killed.
If you do your process in an Activity, when user switched to other Activities in your app, it may still be killed.
Upvotes: 2