Test for START_STICKY in the service

I have an application consisting of a long service. I returned START_STICKY from the onStartCommand method of this service. Now I want to check if START_STICKY is working correctly or not. So, how can I check the scenario that my service was killed by the Android OS due to less memory and it restarts the Android OS and the onStartCommand method is called again. I can’t wait hours to check out this scenario. Please offer a way out.

+3
source share
2 answers

You can try to kill the process from DDMS. The OS may restart it in this case.

+3
source

You can try to kill the service using Killer tasks (if you test by phone)

+1
source

All Articles