Android - service stops when browsing app from recent apps
I have developed an android application with a service that runs in the background the service is called like this
startService(new Intent(getApplicationContext(),myService.class));
but when i uninstall app from recent apps the service stops and crashes if i check it. is there a way to prevent the service from being destroyed when scrolling through the app from recent apps?
Thank you
+3
source to share
1 answer
You can register a service to run in a repeating loop using AlarmManager
http://developer.android.com/reference/android/app/AlarmManager.html
The service will start even if the application is not running.
+3
source to share