问题
I have a service in my app and start it as follows
Intent intent = new Intent(this, Prueba.class);
startService(intent);
Also, your method return onStartCommand STAR_STICKY;
However, every time I close the app the service is restarted. As for the service do not restarts and keep running?
回答1:
Please check it out may be this can be useful for you:
http://developer.android.com/reference/android/app/Service.html#ServiceLifecycle
来源:https://stackoverflow.com/questions/20804228/my-service-is-restarted-each-time-the-application-is-closed