Dropbox Sync Library

Mahares

Expert
Licensed User
Longtime User
i would recommend that you use the Oath2
@aggelos: Thank you very much for your input. You are the only brave one responding to my posts besides Erel.

Aggelos asks: i would recommend that you use the Oath2 to connect to dropbox.
ANSWER: I am not sure what Oath2 is. How does it work with Dropbox?

Aggelos asks: are you sure the file that you change has been fully uploaded to dropbox? maybe you dont get the latest version because the other device/computer did upload the file yet.
ANSWER: Yes, I am sure because I prepare the text files (all are small) on my PC using Access and I can see the new files in Dropbox. It takes the second service 5 minutes after the first one before the new files appear on the device.

Aggelos asks: use anyInProgress to see if background syncing has actually finished when you download a file.
ANSWER: What is anyInProgress and how does it work. How does it work with Dropbox?

Aggelos asks: before download do a .sync. wait for it to finish and then download the file.
ANSWER: Currently, I start the download in Sub Manager_AccountReady (Success As Boolean). Do you think I should move it inside Sub manager_SyncCompleted (Success As Boolean)?

Aggelos asks: see the unfiltered logs to see what dropbox is doing .
ANSWER: I will check the unfiltered logs.
 

aggelos

Member
Licensed User
Longtime User
If you have never used Oath2 then it will be hard to implement.First time always is.
Oath2 is a mechanism in order to connect to a service(dropbox,google drive ,etc) .search the forum there are examples.

-- Do you think I should move it inside Sub manager_SyncCompleted (Success As Boolean)?
YES! maybe thats the whole problem. also use if success=true then download the file

anyInProgress see previous posts. its used to check if dropbox has actually finished background syncing.

*** maybe it would be a good idea to delete your local file before starting the download.

also if your file is open by any program or subroutine it may not download the newer version. I dont know what dropbox will do in this situation.

use the autosync flag. if you are not sure where to put it, put it in multiple places.

if you have setMaxFileCacheSize to 0 and there is no syncing and open files, the cache size should be 0.
use getFileCacheSize to confirm it.if your cache is not zero something is not right.
Cache size will grow when you download/upload a file but after the download is completed it should return to 0
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
Sub manager_SyncCompleted (Success As Boolean)?
Thank you aggelos for this suggestion. I will try it. The reason I never gave it a thought is this: If you check Erel's code in the very first post of this Dropbox lib, you will see that he downloads files in Sub Manager_AccountReady (Success As Boolean) not in the SyncCompleted sub. Let us hope Erel checks this post and weighs in with his opinion.
 

Mahares

Expert
Licensed User
Longtime User
If AutoSync is true then the latest file version as reported by Dropbox is downloaded each time.
The question this time is whether to download the files inside: Sub Manager_AccountReady (Success As Boolean) or inside Sub manager_SyncCompleted (Success As Boolean) or it does not matter.
Thank you
 

gadgetmonster

Active Member
Licensed User
Longtime User
Hi Erel

I'm pretty sure Uve configured correctly but when I call manager.initialize I get the following Error:

B4X:
java.lang.NoClassDefFoundError: com/dropbox/sync/android/DbxTwofactorInfo
 at java.lang.Runtime.nativeLoad(Native Method)
 at java.lang.Runtime.doLoad(Runtime.java:421)
 at java.lang.Runtime.loadLibrary(Runtime.java:362)
 at java.lang.System.loadLibrary(System.java:526)
 at com.dropbox.sync.android.NativeLib.ensureLoaded(NativeLib.java:64)
 at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:26)
 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 com.theappspod.dayjournal.settings._activity_create(settings.java:468)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:515)
 at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
 at com.theappspod.dayjournal.settings.afterFirstLayout(settings.java:98)
 at com.theappspod.dayjournal.settings.access$100(settings.java:16)
 at com.theappspod.dayjournal.settings$WaitForLayout.run(settings.java:76)
 at android.os.Handler.handleCallback(Handler.java:733)
 at android.os.Handler.dispatchMessage(Handler.java:95)
 at android.os.Looper.loop(Looper.java:136)
 at android.app.ActivityThread.main(ActivityThread.java:5086)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:515)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
 at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.dropbox.sync.android.DbxTwofactorInfo" on path: DexPathList[[zip file "/data/app/com.theappspod.dayjournal-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.theappspod.dayjournal-1, /vendor/lib, /system/lib]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
 ... 27 more

Any Ideas?
 

gadgetmonster

Active Member
Licensed User
Longtime User
From my observations, this is what appears to be happening. Starting from scratch with app not linked to Dropbox.

Click button1 which runs the code:

B4X:
manager.LinkAccount

This will bring up a dialog asking for permission to allow the app access to my dropbox account. I tap allow.

Now If I stop the app and run it again. Tap Button1 and nothing appears to happen. I have added code into Manager_AccountReady to log the Success variable and this does not appear in the logs.

If I unlink the app using:

B4X:
manager.UnlinkAccount

and then tap Button1 again, the dialog re-appears asking for permission again.

So next I added a button (Button3) to upload a file.

Button3 does a manager.uploadfile()

If I run the app (the app is linked to dropbox now) and simply press button3 - I get an error 'java.an.nullpointerexception'.

If I run the app and press button1 first (nothing appears to happen) and then press button3, I don't get the error but no file is uploaded either,
 

M6SOFT

Member
Licensed User
Longtime User
Hi,
My app works fine with any pre lollipop android version but crashed on Nexus 5 with Android 5. Any idea how to fix it?
B4A 3.82, Dropboxsync 3.00, Dropbox SDK v3.1.1
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.m6.droidgeo-2/base.apk"],nativeLibraryDirectories=[/data/app/com.m6.droidgeo-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libDropboxSync.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.dropbox.sync.android.NativeLib.ensureLoaded(NativeLib.java:70)
at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:32)
at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:228)
at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:141)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:200)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:160)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:107)
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:53)
at com.m6.droidgeo.dropbox._activity_create(dropbox.java:343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at com.m6.droidgeo.dropbox.afterFirstLayout(dropbox.java:98)
at com.m6.droidgeo.dropbox.access$100(dropbox.java:16)
at com.m6.droidgeo.dropbox$WaitForLayout.run(dropbox.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
 
Last edited:

stu14t

Active Member
Licensed User
Longtime User
Have you tried the current version of the DropboxSync 3.1? Just a thought
 
Top