Suspending an Upload

An ongoing file upload can be manually suspended.

The following sample code shows how to suspend an ongoing file upload.

  • // Assume that "uploader" handles the ongoing upload.
    
    try {
      // Suspend uploading.
      uploader.suspend();
    } catch (NoEntryException e) {
      // The uploader was not found. Most likely the upload has already been completed.
    } catch (StateStoreAccessException e) {
      // Failed to access the local storage.
    }
  • // Assume that "uploader" handles the ongoing upload.
    
    // Suspend uploading.
    uploader.suspendAsync(new KiiRTransferCallback() {
      @Override
      public void onSuspendCompleted(KiiRTransfer operator, Exception exception) {
        if (exception != null) {
          // Handle the error.
          return;
        }
      }
    });

Call the suspend() method to suspend an upload. An error will be returned if you attempt to suspend a finished upload.