0

I am running an AsyncTask on the login screen for which I am using process dialog.

The problem is if I kill my application from recent application or from the settings and again launching it from launcher.

1.It is starting from the last activity opened.

2. It is starting my assyncTask also due to which my application is crashing because it is not getting View.

Question is:- how I can start my application from scratch if it is killed from task Manager.

  • why would You do this? Android handles like this for a good reason. I don´t think that it would be good if an app can always restart itself if it gets killed... – Opiatefuchs Jan 29 '15 at 14:05
  • Also (for point 2), You should ask Yourself, why Your app crashs and how to avoid this... – Opiatefuchs Jan 29 '15 at 14:06
  • Other application if I kill from task manager , they are staring from scratch. how they achieve this. please help – Jitendra Jaiswal Jan 29 '15 at 14:18
  • For this You have to use a Service and use startForeground(). Here are some examples: http://www.truiton.com/2014/10/android-foreground-service-example/ and: http://stackoverflow.com/questions/9696861/how-can-we-prevent-service-from-killing-by-os-in-android – Opiatefuchs Jan 29 '15 at 14:33

0 Answers0