How to set a timed event which will keep running even if the application is stopped
<p>I need to have a process run whenever the end-user clicks on a Submit button. The application needs to try to process the data on the screen every X minutes, Y times, even if the the application is down. So, it will need to attempt to do some processing until one of the following occurs:
1) The processing is successful for the data that was submitted
2) The processing has been retried Y times and still never succeeded
3) The application is terminated by the OS or the phone is turned off.</p>

<p>If the end-user's phone is still on but the application has stopped,
what's the correct interface to use to accomplish this? </p>

<p>If I use Handler/Runnable, that only works as long as the application stays active.
AlarmManager looks like it's used when you want processing to run at a specific time.</p>

<p>Any suggestions will be greatly appreciated!</p>
