I'm working on an android project where I've to start a service every time the app is closed. That works correctly. The problem is the following: if the app is killed while is in second plane, the onDestroy
method is performed but the service never starts. Here is the case:
- Open the app
- Pass it to second plane (by minimizing)
- From the list of app that are in second plane, I close my app using the option "Remove from list"
On the onDestroy
method I have another method that initializes the services and the services is configured with return Service.START_STICKY;
I've seen several questions (for example: START_STICKY and START_NOT_STICKY, Continue service when app is killed , Starting a service from application class) but they have not worked.
Thanks