I'm creating a chat app and I am wondering if I should use a service and how it will affect the lifecycle of my app. I understand that the Android OS can destroy my app if there isn't enough memory. My question: do apps that only use Activities and Receivers get restarted if Android destroys them or do I need a STICKY Service for this? I've created apps with both, so I have somewhat of an idea, but I just want to make sure.
Second, http://developer.android.com/reference/android/app/Service.html says:
Note that services, like other application objects, run in the main thread of their hosting process. This means that, if your service is going to do any CPU intensive (such as MP3 playback) or blocking (such as networking) operations, it should spawn its own thread in which to do that work.
My application has a long running thread (AsyncTask) that does the reading from the server (and constantly blocking). Is it a good idea to leave my app as it is, without a service and use the AsyncTask instead? How will this affect the lifecycle of an app if Android chooses to close my app? Is it good practice to have a long running service if there doesn't need to be, as in, should I make a STICKY Service anyway? I noticed a lot of chat and txt msg apps use a sticky service. I'm just trying to think if my app would need one.
Thanks again in advance!