Dropbox Sync Library

Mahares

Expert
Licensed User
Longtime User
How can I make this below function work. If not possible, will this be available in the next well anticipated version of this great lib?
B4X:
Sub Manager_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
 Dim lblDLSummary  As label
    If Total > 0 Then
      lblDLSummary.Text = "Downloaded " & Round(TotalDownloaded / 1000) & "KB, Out Of " & Round(Total / 1000) & "KB"
    Else
      lblDLSummary.Text = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
    End If
 End Sub
 

Mahares

Expert
Licensed User
Longtime User
There is no DownloadProgress event in this library. I guess that you are requesting this feature?

@Erel: I started using Dropbox sync lib very recently and I like it a lot better than using FTP, far fewer problems, if it only has a few more features like the download progress and file sizes, etc. I would recommend a newer version if you have the time to do it.
By the way, for your information, I upload and download several text files to Dropbox with the .tab extension, but surprisingly, the .tab extension was not permitted among their list of permitted file extension. Any file with .tab extension was refused. Finally after convincing their developers via few pleading emails, they added it as one of the permitted extension. The above note about tab extension is a followup to the question I asked you in Post #129 and post #130.
 

cdsincfl

Member
Licensed User
Longtime User
Hi Erel,

Thanks for B4A and the DropboxSync Lib.

I have installed all the files and created the test project as described at the beginning of this post. I have read all of the posts and suggestions and verified my project code, installed files etc.... Still it does not work. The test project never reaches the "Manager_AccountReady" sub. I have my log and it contains many entries similar to this:

Prepared cache dir '/data/data/b4a.testsync/app_DropboxSyncCache/MYKEYXXXX'.

Trying to load lib /data/data/b4a.testsync/lib/libDropboxSync.so 0x4051c428

Dropbox initialized for application: MYKEYXXXX (b4a.testsync/1 DropboxSync/2.1.1 (Android; 2.3.5; HTC Desire HD armeabi-v7a; en_US))
false true
false true

Button_Click LinkAccount....
Requesting link for a Dropbox new account.
Starting activity: Intent { cmp=b4a.testsync/com.dropbox.sync.android.DbxAuthActivity (has extras) } from pid 4859
** Activity (main) Pause, UserClosed = false **
Starting activity: Intent { cmp=b4a.testsync/com.dropbox.client2.android.AuthActivity (has extras) } from pid 4859

DROPBOX_ERROR_USAGE: sync.cpp:244: This app is not allowed to use the Sync API for file access.
DROPBOX_ERROR_USAGE: sync.cpp:244: This app is not allowed to use the Sync API for file access.
saving to /data/data/b4a.testsync/app_DropboxSyncCache/MYKEYXXXX/logs/err-nouser-1396213559.txt
uploading log file /data/data/b4a.testsync/app_DropboxSyncCache/MYKEYXXXX/logs/err-nouser-1396213559.txt

The errors keep repeating mostly the last 4 lines above.

I have the complete log if it is needed just not sure what entries apply to my problem.
I am using these:


Any help or suggestions are greatly appreciated.
 

cdsincfl

Member
Licensed User
Longtime User
Followup:

I am using these files:
DropboxSync Ver. 1,25
dropbox-sync-sdk-android.jar Dated: 3-17-2014 Size: 313kb
HTC Inspire 4G
Android 2.3.5
Dropbox version: 2.3.11.4
Previous post sent before I was able to add these.
Thanks again for any help.
John
 

cdsincfl

Member
Licensed User
Longtime User
Erel,

I have checked the app settings and the key and secret are correct.
My Dropbox app is set to:
Status - Development
Development Users - 0/100
OAuth2 - blank, no Redirect URI's
Drop-ins domains - blank
I have the Dropbox app named "StashTest"
B4A Package Name - b4a.testsync
B4A #ApplicationLabel: B4A-Sync

When I run the app I get the request to link to my Dropbox and select "Allow".
Nothing else happens after that except the errors in the log.

I know it must be something simple but what am I missing here?

John
 

GMan

Well-Known Member
Licensed User
Longtime User
Sounds very miracolous why it didnt work for you.
Its normally as simple as written before - 1st time you habe to login via Web (through the App i.e. by choosing a backup function) and grant access for the app in the given DropBox account.
If this is done once, any click of the "Backup" function sends the declared file to the App-Folder in the dropbox account.

Did you post the depending code already ?
 

cdsincfl

Member
Licensed User
Longtime User
Hi GMan,

I just started over with the code from the first of the post.
Installed and get the same error:
"DROPBOX_ERROR_USAGE: sync.cpp:244: This app is not allowed to use the Sync API for file access."

The app never reaches "Sub Manager_AccountReady" and just keeps returning the above error in the log.

I have uploaded my code and the log file to this post.

Thanks for any help.

John
 

Attachments

  • DropboxTest.zip
    17.8 KB · Views: 270

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi,

I have used this dropbox library without problems until now (on my Nexus5 kitkat 4.4.2).
And one of my (unknown) users reports this bug :

B4X:
java.lang.ExceptionInInitializerError
at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:155)
at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:126)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:150)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:116)
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:53)
at fr.free.julienGley.SecretRecorder.main._activity_create(main.java:495)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at fr.free.julienGley.SecretRecorder.main.afterFirstLayout(main.java:98)
at fr.free.julienGley.SecretRecorder.main.access$100(main.java:16)
at fr.free.julienGley.SecretRecorder.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load DropboxSync: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:429)
at java.lang.System.loadLibrary(System.java:554)
at com.dropbox.sync.android.NativeLib.ensureLoaded(NativeLib.java:64)
at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:26)
... 21 more

As far as I can understand it seems that hte Sync library was unreachable...

Any idea of the reason of this crash ?

Thank you
 

freedom2000

Well-Known Member
Licensed User
Longtime User
The native library is not buggy. The native library for non-arm CPU is not included.

Ok I understand now ... (sorry for the mistake)

So it is dependant on the hardware (OS ?) running my App.

So far I have now 3 bugs reported :

Android version : 2.3.3 - 2.3.7
device : hsdroid2

and

Android version : 2.3.3 - 2.3.7
device : Xperia X10 (X10i)

Does it exist a way to prevent the App from crashing and rather toasting a message "dropbox not supported" ?
Or better, you mentionned that I could add a lib into the libs folder. I can't find this lib...

Any idea please ?
 

GMan

Well-Known Member
Licensed User
Longtime User
Does it exist a way to prevent the App from crashing and rather toasting a message "dropbox not supported" ?
B4X:
Try
  (your code)

  Catch as exception
      (your Error Message)
End Try
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The Try / Catch block will most probably not work here as this error is considered a critical error.

You need to add these folders from the SDK to DropboxSync jar:
SS-2014-04-13_15.04.51.png
 
Top