Suspending a Download
An ongoing file download can be manually suspended.
The following sample code shows how to suspend an ongoing file download.
-
// Assume that "downloader" handles the ongoing download. try { // Suspend downloading. downloader.suspend(); } catch (NoEntryException e) { // The downloader was not found. Most likely the download has already been completed. } catch (StateStoreAccessException e) { // Failed to access the local storage. }
-
// Assume that "downloader" handles the ongoing download. // Suspend downloading. downloader.suspendAsync(new KiiRTransferCallback() { @Override public void onSuspendCompleted(KiiRTransfer operator, Exception exception) { if (exception != null) { // Handle the error. return; } } });
Call the suspend()
method to suspend a download. An error will be returned if you attempt to suspend a finished download.