public interface MediaHttpUploaderProgressListener
Sample usage (if media content length is provided, else consider using MediaHttpUploader.getNumBytesUploaded()
instead of MediaHttpUploader.getProgress()
:
public static class MyUploadProgressListener implements MediaHttpUploaderProgressListener { public void progressChanged(MediaHttpUploader uploader) throws IOException { switch (uploader.getUploadState()) { case INITIATION_STARTED: System.out.println("Initiation Started"); break; case INITIATION_COMPLETE: System.out.println("Initiation Completed"); break; case MEDIA_IN_PROGRESS: System.out.println("Upload in progress"); System.out.println("Upload percentage: " + uploader.getProgress()); break; case MEDIA_COMPLETE: System.out.println("Upload Completed!"); break; } } }
Modifier and Type | Method and Description |
---|---|
void |
progressChanged(MediaHttpUploader uploader)
Called to notify that progress has been changed.
|
void progressChanged(MediaHttpUploader uploader) throws IOException
This method is called once before and after the initiation request. For media uploads it is called multiple times depending on how many chunks are uploaded. Once the upload completes it is called one final time.
The upload state can be queried by calling MediaHttpUploader.getUploadState()
and the
progress by calling MediaHttpUploader.getProgress()
.
uploader
- Media HTTP uploaderIOException
Copyright © 2010–2021 Google. All rights reserved.