an IntentService
stops itself when the onHandleIntent()
method exits. that's one of the benefits of it over a regular service- you don't need to manage the life cycle.
from the Android Documentation page for IntentService.onHandleIntent()
,
This method is invoked on the worker thread with a request to process.
Only one Intent is processed at a time, but the processing happens on
a worker thread that runs independently from other application logic.
So, if this code takes a long time, it will hold up other requests to
the same IntentService, but it will not hold up anything else. When
all requests have been handled, the IntentService stops itself, so you
should not call stopSelf().
as far as pausing / resuming an upload, you'd need to be using non-blocking IO. there's no way to interrupt or otherwise stop blocking IO. the best you can do is set some state telling yourself to throw away the result when it's finished. non-blocking IO is a tad more complicated and beyond the scope what can be discussed here. here's one reasonable tutorial on the topic. if you are using a higher-level API (like the AWS Android API) to interact with S3, that API needs to support non-blocking IO.
in your case, you could keep state a database for each upload. when you get a result in your intent service, you can query the DB to see if the user canceled the upload.
if you are looking for a robust way to download files with pause / resume support, have you looked at the DownloadManager
API?