B4A Library Dropbox SDK V2 - Java

dropbox_blue.png



This is a wrap for the Dropbox JAVA SDK for Android.

It is a request for the community too to parcitipate to this project doing test or writing documentation for the objects.

List of connected Tutorials:
- Dropbox SDK V2 - Authentification
- Dropbox SDK V2 - Uploading big files to Dropbox
- Dropbox SDK - get informed about changes in the used Dropbox


DropboxV2
Comment:
The Dropbox library allows you to communicate with Dropbox
Author: DonManfred (wrapper)
Version: 0.65 (wraps the SDK dropbox-core-sdk-6.0.0)

Wrapped Objects so far
  • DbxAuth
  • DbxClientV2
  • DbxHost
  • Dimensions
  • DbxRequestConfig
  • DbxUserAuthRequests
  • DropboxV2
  • DbxUserFilesRequests
  • FileMetadata
  • FolderMetadata
  • FolderSharingInfo
  • GpsCoordinates
  • Mediainfo
  • MediaMetadata
  • Metadata
  • RelocationPath
  • DbxUserSharingRequests
  • MemberSelector
  • SharedFileMetadata
  • SharedFolderMetadata
  • SharedLinkMetadata
  • BasicAccount
  • FullAccount
  • DbxUserUsersRequests

The Download will always be here in Post #1 of the Thread.

Additional to the provided Library (xml and jar) you need to download:
1. Download this file.
Extract the zip and copy the files to your additional libraries folder.

Add this lines to your Mainmodule
B4X:
#AdditionalJar:dropbox-android-sdk-6.0.0.aar
#AdditionalJar:dropbox-core-sdk-6.0.0


In the following posts i´ll add some more detailed info on the different Objects.
 
Last edited:

Gavins

Member
Licensed User
Longtime User
Ok, no problem. Is there any way to fix the issue with the dbxfiles_delete delegate?

It feels like a syntax issue (as I had to guess at 'success As Boolean, meta As FileMetadata, error As String') with the variables being passed to it to me as it successfully enters the delegate if the file isn't there to delete, but errors if a file is actually deleted.
 

migliore150267

Member
Licensed User
Longtime User
I have the same problem with other method like dbxFiles.createFolder. The folder is created but the app crash because a different signature in event 'Sub dbxFiles_CreateFolder'.
 

Gavins

Member
Licensed User
Longtime User
Are there any plans to update or continue development of this library? I recently received an email from Dropbox that the version of the java SDK my app uses (i.e this library) is outdated and there's an issue that will likely cause it to break with a future update if it's not updated.
 

DonManfred

Expert
Licensed User
Longtime User
I recently received an email from Dropbox that the version of the java SDK my app uses (i.e this library) is outdated and there's an issue that will likely cause it to break with a future update if it's not updated
I´ll update the library with the new SDK. But it may take some time as time is limited these days.
 

tsteward

Well-Known Member
Licensed User
Longtime User
I'm finding this a little confusing with my limited knowledge, but I'm getting there.
I am able to upload one file at a time, but how would I go about uploading a list of files?

Just to explain further I want to upload all file "*.txt" to the one folder.
I have created a list of file names. But looping through the list as follows doesn't work.
B4X:
For F = 0 To filelist.Size-1
                        filname = filelist.Get(F)
                        dbxFiles.upload(Starter.DBFileDir,filname,"/" & filname,False,False)
                    Next
 

DonManfred

Expert
Licensed User
Longtime User
You can

Creae a list of all files to upload. Maybe a list of maps holding all informations.

A. upload the next file from your list when one is finished
B. Start multiple upload calls in paralel (for short files this should be no problem)
 

tsteward

Well-Known Member
Licensed User
Longtime User
Y
You can

Creae a list of all files to upload. Maybe a list of maps holding all informations.

A. upload the next file from your list when one is finished
B. Start multiple upload calls in paralel (for short files this should be no problem)
Yeah gave this a shot but its way too slow.
 

netsistemas

Active Member
Licensed User
Longtime User
Allways that i run my app, the screen to confirm login/access to dropbox, are launched.
Why?
Because you lunch the code:
B4X:
auth.startOAuth2Authentication
this code must be start only one time. When you have the token, you need set then var
B4X:
DropboxEnabled = True
and do this:
B4X:
Sub Activity_Resume
    If DropboxEnabled = False Then
        If auth.OAuth2Token <> Null Then
            If auth.OAuth2Token <> "" Then
                token = auth.OAuth2Token
....

and for delete a files in dropbox, the app crack in Release Mode (in debug all is ok).
You need to similar to this:

B4X:
Sub Timer_Tick
    Timer.Enabled  = False
    Try
   
        dbxFiles.delete(FileWeb)

        'wait for dbxFiles_Delete(sucess As Boolean, path As String,error As String)
'code correct:
waitfor dbxFiles_Delete(success As Boolean, msg As Object ,error AsString)
Dim I As FileMetadata
i = msg

   

    'Msgbox ("Borrado " & FileWeb  ,"Borrado")
   
        '    Msgbox("Borrado","Borrado")

    Catch
        Log(LastException)
    End Try
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
You already know the answer
this code must be start only one time
Right. Note to store the token you got for a later start of your app. For ex. in a KSV.
Check the KVS on appstart if it contains a token. If there is a token; do not request authorisation. Instead use the stored token.
 

DonManfred

Expert
Licensed User
Longtime User
As i lost the source of this lib half a year ago with my HDD crash i do not have the source anymore. So no chance to change anything.
I´ve asked Erel to move the thread to the Library Archieve.

I don´t know if i ever have enough mood for a complete rewrite in the future.

I suggest to use the HTTP-Version for now.
 

DonManfred

Expert
Licensed User
Longtime User
As i lost the Source of the Library i did decompiled the old Library.
Some methods could not be decompiled. For example the complete Upload Method i wrote.
I rewrote some part of the Lib to be able to Compile it again.

I also rewrote (found a suitable example in the Internet which i adapted to be useable in my Library) the Upload Method using the new Upload Session from the Dropbox SDK.

The Lib depends on V3.0.7 of the SDK.

I updated the Lib in #1
 

rafaelmotaquintana

Active Member
Licensed User
I copied all the libraries as instructed, and ran the sample project
In browser, from dropbox, I get this message

it seems the app you're using submitted a bad request. if you'd like to report this error to the app's developer, include the information below

this app is not valid

What should I do?
 

Tempomaster

Active Member
Licensed User
Longtime User
Hello,

the library works great. Unfortunately I can not search for a file:

B4X:
dbxFiles.search("","searchfile.zip",??????,1,1)

I need help what you specify for the mode (??????). At which event do you receive the result? I thank you in advance.


Best regards,
Gunnar
 

DonManfred

Expert
Licensed User
Longtime User

Tempomaster

Active Member
Licensed User
Longtime User
I tested:

dbxFiles.search("","searchfile.zip",1,1,1)

Ich habe als Konstante "1" verwendet.

This brings this error in the execution:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
search()
java.lang.IllegalArgumentException: No enum constant com.dropbox.core.v2.files.SearchMode.1
    at java.lang.Enum.valueOf(Enum.java:257)
    at com.dropbox.core.v2.files.SearchMode.valueOf(SearchMode.java:18)
    at de.donmanfred.dbxv2.files.DbxUserFilesRequestsWrapper$27.run(DbxUserFilesRequestsWrapper.java:1307)
    at java.lang.Thread.run(Thread.java:764)

I am doing something wrong.
 
Top