Android: Activity needs to be minimized or hidden, how to keep it alive?

Have a look at this tutorial that discusses how to build an application with a background service. You may also refer the official documentation on the Service class.

Kindly have a look at the "Edit Info" to know clearly where am I stuck and also concerned. – Tvd May 16 at 8:51.

The Service could check to see if the Activity is running (via an IBinder) and start a new one in case it was killed see my response here for links to tutorials on this. Another possibility is to create an Application object that has references to both the Activity and the Service, that you can use to manage your needs. Applications are less likely to be killed than Activities.

Anyhow, it all comes down to restart your Activity if it was killed. Use saveInstance() to save any data you need from your Activity (See this question).

Aleadam, Thanks for the links. Kindly have a look at the indo added to question. Do you say that using IBinder, and binding it with the activity, untill the service is running, activity won't go in pause stage for longer i.e.

What I am concered is somewhat wrong? – Tvd May 16 at 8:53.

I do bind the servie with the Activity and the service has stub that is returned to the Activity, And as required service sends message to the Actiivty - on some msgs only activity will inform the user but messages are notified by the service to the activity. Secondly another AsyncTask is also running which will also notify activity on regular intervals. And if any connection is lost, Activity handles to start that task/service again informing the user.

I have managed this much so far, but am just concerned about the killing of activity. Service and ASyncTask will be running and notifing user, but UI won't be visible all time on top, so that will be in onPause stage. If in low memory case system kills the activity then?

Do you try to say that if service is binded and notification will be going on then activity won't be killed as it is active though not visible? I am little bit confused, concerned and don't understand clearly is their any req to handle this stage of my application. If so, how?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions