Dropbox Sync Library

tkristensen

Member
Licensed User
Longtime User
I've run into a frustrating problem.

I'm using the library to upload files from the tablet to dropbox.

I loop through the list of files to upload, call the upload routine, which doesn't error, then I periodically check the dropbox directory to see if I have successfully sent the file and even verify the filesize, all files show in the dropbox directory and all show the correct file size.... BUT only the first 3 files of the original list actually make it to dropbox.

Is there a better way to confirm the upload has actually taken place?
 

luke2012

Well-Known Member
Licensed User
Longtime User
First of all : very interesting library (my compliments).

This post is my first approach to DropBox.

I'm planning to implement an app that manage a file sinc between many devices.
One device upload the file and the other devices download the file in a predefined path.

From a User perspective, which steps are mandatory for the user in order to handle the correct dropbox account ?

First Scenario :

- User doesn't have a dropbox account

Second Scenario :

- User have a DropBox account
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
When you upload a file, the file is saved in the local cache and should be uploaded automatically by the Dropbox service. Currently there isn't any event when the file is actually uploaded to the server. Dropbox service should retry to upload the file if there was a problem.

@luke2012 this library will only work if the user has a Dropbox account. When you first link the account the user will need to approve it. A dialog will be displayed asking the user to confirm this operation.
 

luke2012

Well-Known Member
Licensed User
Longtime User
When you upload a file, the file is saved in the local cache and should be uploaded automatically by the Dropbox service. Currently there isn't any event when the file is actually uploaded to the server. Dropbox service should retry to upload the file if there was a problem.

@luke2012 this library will only work if the user has a Dropbox account. When you first link the account the user will need to approve it. A dialog will be displayed asking the user to confirm this operation.

So if the target is to sync a file a group of devices that have the same App installed, I can create a DropBox Account dedicated to this App and tell the user to use the credentials of this account in order to handle DropBox.

In this scenario all users can use the file sync (also the users that don't have a dropbox account).

It's correct ?
 

luke2012

Well-Known Member
Licensed User
Longtime User
Not exactly. They will need to first install Dropbox app and register it with this account.

This API is more useful when you want the user to easily share his creations on multiple devices / computers.

Assuming that the BA4 app is ready to manage the shared Dropbox account, when the user ask to use the Dropbox sync functionality within my app, the first step is to ask user to install Dropbox app and login using the shared account that I provide to him.

Then I can manage programmatically my app files within the application, correct?
 
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
In Erel's case you have to delete the App in the depending DropBox Account and have to configure the new one first, too (as usual).
The case your are describing is better solved with ftp-access and up-/download....
 

luke2012

Well-Known Member
Licensed User
Longtime User
Thanks Erel & GMan for your replies!
So the best solution in my case is to use a shared ftp account that should be simplify the user management.

In my scenario I have a group of smartphone and only one of this is the "Master" that upload the updated file and the other smartphone download the updated file.
 

peterecollins63

New Member
Licensed User
Longtime User
I get error in sub:main_actvity_create(java line: 241) java.lang.IllegalStateException:Requried Sync API Activity isn't inlcuded in application manifest: com.dropbox.clinet2.android.AuthActiviity.com.dropbox.sync.adnroid.DbxAuthActivity Continue?
thought i'd followed all the steps. any thoughts?
 

TeoApp

Member
Licensed User
Longtime User
Hi Erel,
it is great!! I've been waiting this library since last year...Now I get my app sync with drop.
How can I have success message when I use upload method?
for example
B4X:
Sub Manager_DownloadCompleted (Success As Boolean, LocalDir As String, LocalFileName As String)
Where I can find all methods that I can use with dropbox library?
Thanks in advance.
 

Paulsche

Well-Known Member
Licensed User
Longtime User
I have now installed my app on another machine and get the following message:
In this phase of development of the app are only available for a limited number of users access token available "
dropbox.png
 

rboeck

Well-Known Member
Licensed User
Longtime User
I have now installed my app on another machine and get the following message:
In this phase of development of the app are only available for a limited number of users access token available "
View attachment 19839

In the developer console of dropbox you can choose the amount of users, who can test your app; you can define max. 100 test users...
 

Paulsche

Well-Known Member
Licensed User
Longtime User
I do not understand why test user?

I would like my app that the user can make a backup on your Dropbox account, and indeed all users.
 

rboeck

Well-Known Member
Licensed User
Longtime User
When you are inside the developer console, you see your app(s) listed, then below in the second line: Status: Development
Then you click on this app, you come to the details page; here you find an button "Apply for production", the second line 0/100 development users.
In dont know exactly, what the consequences of this status changes are; read here:

https://www.dropbox.com/developers/reference/devguide

Greetings
Reinhard

P.S.: If you only want to use dropbox as place for backup copies, you could use this code to share a file; currently its for text files:
B4X:
Dim r As Reflector
    Dim f As Object
  
    f = r.CreateObject2("java.io.File", Array As Object(Fn), Array As String("java.lang.String"))
  
    Dim share As Intent
    share.Initialize(share.ACTION_SEND,"")
    share.SetType("text/x-vcard")
    share.PutExtra("android.intent.extra.STREAM", r.RunStaticMethod("android.net.Uri", "fromFile", Array As Object(f), Array As String("java.io.File")))
    share.WrapAsIntentChooser("Adressdaten senden")
    StartActivity(share)
 
Last edited:

stefanoa

Active Member
Licensed User
Longtime User
I've a problem with download, when run this code:

B4X:
Sub restoreDB_Dropbox
   manager.LinkAccount
End Sub

Sub Manager_AccountReady (Success As Boolean)
  If Success Then
          Dim filesList As List
          filesList.Initialize

          For Each FileInfo As DbxFileInfo In manager.ListFiles("/")
            filesList.Add(FileInfo.Name)
          Next
    
        Dim result As Int
        result = InputList(filesList, trans.GetText("Choose Backup File"), -1)

        Dim xFileName = filesList.Get(result)
        Dim xFileNameComplete = File.DirRootExternal & "/MLB_Backup/" & xFileName
      
        result = Msgbox2(trans.GetText("Confirm the Restore") & "?", xFileName, trans.GetText("Yes"), "", trans.GetText("No"), LoadBitmap (File.DirAssets, "question.ico"))
      
        If result = DialogResponse.POSITIVE  Then
              manager.DownloadFile("/", xFileName, File.DirRootExternal & "/MLB_Backup", xFileName)
        End If
    
    End If
end sub

Sub Manager_DownloadCompleted (Success As Boolean, LocalDir As String, LocalFileName As String)
   Dim xFileNameComplete = LocalDir & LocalFileName
   myZip.ABUnzip(xFileNameComplete,  File.DirDefaultExternal  & "/")

   Msgbox(trans.GetText("Now the application will be closed. Please restart."),"Restore completed")
   ExitApplication
End Sub
this message appears in the log and the download is not executed:
sending message to waiting queue (manager_downloadcompleted)

any ideas?
thanks
 
Top