Android Tutorial Dropbox SDK V2 - Uploading big files to Dropbox

This Tutorial will show you all needed Code to do Uploads to Dropbox.

Requirement for this tutorial: you need to have your App Dropbox-ready (see Tutorial I - Authentification).

Asuming you already have your app setup and you already have a accesstoken and Dropbox is initialized fully.


There are two kind of uploads to Dropbox. Normal uploads (which can be up to 150mb in one call) and big uploads which are using a Uploadsession.

Updated Date 20th june 2018

This tutorial will only handle the Uploads using a Uploadsession from version V0.40+ of the Dropbox V2 Library.


B4X:
dbxFiles.uploadsession(path,filename,File.Size(path,filename),0,"","/OSM/", dbxFiles.WriteModeADD)

The default upload chunksize is 8MB. For now it is not chnageable.
While uploading it will raise an Progress Event
B4X:
Sub dbxFiles_UploadProgress(sessionId As String, path As String, filename As String, uploaded As Long, size As Long)
    Log($"${filename} -> ${NumberFormat(uploaded / 1024, 0, 0)} KB /${NumberFormat(size / 1024, 0, 0)} kb -> ${NumberFormat(100 * (uploaded / size), 0, 2) } - Session ${sessionId}"$)
End Sub

B4X:
Sub dbxFiles_UploadFinished(success As Boolean, metaObj As Object, sessionId As String)
    Dim meta As FileMetadata = metaObj
    Log($"dbxFiles_UploadFinished(${success} Session ${sessionId} -> ${meta})"$)
End Sub

will be raised to inform about the finished upload.

I´ve tried it with a some big files.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…