Is there any difference between Android Application Settings -> Force Stop & Stop Process under Eclipse?

StackOverflow https://stackoverflow.com/questions/17592263

  •  02-06-2022
  •  | 
  •  

Pregunta

I have developed a simple background service, which tries to prove self resistance when app is killed. For this purpose I return in onStartCommand - START_STICKY - obvious !

When I'm testing killing service's process either:

  1. from Application Settings -> Force Stop
  2. or under Eclipse DDMS perspective Stop Process...

I noticed that in the 1st scenario the service is never restarted. On the other hand in the 2nd scenario the service is re-created and onCreate method is called...

Why it is like that? Any differences in killing processes by these two approaches?

¿Fue útil?

Solución

Any differences in killing processes by these two approaches?

Yes. In DDMS, "Stop Process" kills the process. With "Force Stop", not only is the process killed, but it is moved into the "stopped" state, where nothing in that app will run again until somebody manually runs one of that app's components (typically: the user launches an activity from the home screen).

You can read more about the stopped state in the Android 3.1 documentation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top