Dropbox Sync Library

aggelos

Member
Licensed User
Longtime User
I have a question.
i got an ANR from 1 of my users

the code runs inside a service

java.lang.RuntimeException: java.lang.Exception: Sub dbxmanager_downloadcompleted was not found.

does the downloadcompleted event have to be implemented? i dont need it so i dont have it in the app.
do i have to write a blank Sub dbxmanager_downloadcompleted ?
 

aggelos

Member
Licensed User
Longtime User
I use the dropbox only for backup. so when the user wants to restore his files i just mass download them.
So no need to use the files right away.

why dont i use automatic syncing? because i dont want to download all files from dropbox to his phone.
 

Mahares

Expert
Licensed User
Longtime User
I use a service to upload a text file from the phone to Dropbox (using Dropbox lib) every day scheduled at 3:30 PM. Most of the time the text file (20 KB in size or so) is uploaded on time at 3:30 PM. But occasionally the file does not uploaded until a few hours later. Is that because there was no internet when the scheduled time of 3:30 PM happened and later when internet was available the text file is uploaded.
Thank you for any clues.
 

Mahares

Expert
Licensed User
Longtime User
It is hard to say as it is Dropbox app that actually synchronizes the local cache with the server.
I do not expect Erel to have the answer to every question because he does not have time to experiment with every library, but has anyone else that uses the Dropbox library experienced the issue I have which is: Upload text file from phone scheduled every day at 3:30 PM, but occasionally the file does not upload until a few hours past the scheduled service time.
 

aggelos

Member
Licensed User
Longtime User
I would like to say that this is not a problem with the dropbox library.
I think its a problem with your app and/or the device you are using.

A million things could happen as to why there is a delay.

why dont you check the unfiltered logs from the device?
everything you need to know about what an app does is in there.
check the logs and you will see that your app starts to upload the file and then you should see dropbox syncing the file.
If dropbox is not syncing it , it will probably tell you why.
and i think in the logs it will say if the internet is up or down.

do you use a service to upload the file at 3:30? are you sure the service starts on time?
do you awake the phone at 3:30? some phones need to be fully awake to use the wifi or 3g connection.
have you tried another real device?another brand.
 

Mahares

Expert
Licensed User
Longtime User
@aggelos:
I think its a problem with your app and/or the device you are using.
I use the Samsung S4 phone to upload the file. 85% of the time it runs on time at 3:30 PM. Just once in a while it uploads later than 3:30 PM.
If dropbox is not syncing it , it will probably tell you why.
and i think in the logs it will say if the internet is up or down.
There are times where there is no internet available in the area around 3:30 PM where the device in the field is located as the terrain is desolate and mountainous.
do you use a service to upload the file at 3:30? are you sure the service starts on time?
do you awake the phone at 3:30? some phones need to be fully awake to use the wifi or 3g connection.
have you tried another real device?another brand.
There are 6 Samsung S4 phones that upload their text files extracted from a SQLite database and are all set with a service that runs at 3:30 PM. As mentioned, the delay only happens 15% of the time. The problem can happen to any of the six when not in proximity of wifi or no cell capability in the area.
If we assume occasionally there is no internet at the time of the service, why would the file upload later when internet is available after the set time has expired?
 
Last edited:

aggelos

Member
Licensed User
Longtime User
I dont get it, if there is no internet at 3:30 how you expect the file to be uploaded?

the file will be kept in the local dropbox cache and the dropbox will upload it when it thinks the internet is up

i think that you dont understand how the dropbox sync api works.
you should read the sync api documentation on the dropbox.com site

1) your app tells the dropbox sync api "i have a file that i want to upload"
2) sync api says "ok, give me the file and i will take care of it"
3) sync api stores the file in the local dropbox cache
4) sync api tries to contact dropbox site in order to upload the file
if there is no internet it will retry sometime later.
you cant predict when. nothing guarantees you that the upload will happen as soon as the internet is up.
The internet may come up at 4:00 and the dropbox api will upload your file at 4:20.

i still dont understand the problem. you don't want the file to be uploaded when the internet comes up?

If we assume occasionally there is no internet at the time of the service, why would the file upload later when internet is available after the set time has expired?

why do you think dropbox uploads expire? where did you see that?

if you dont want your app to upload the files without internet you should check to see if you have internet before doing the upload.


.
 

Mahares

Expert
Licensed User
Longtime User
I dont get it, if there is no internet at 3:30 how you expect the file to be uploaded?
I do not expect the text file to be uploaded when there is no internet. However, I thought that the file will wait until the next schedule service which is tomorrow at 3:30 PM before it uploads. But your explanation makes a lot of sense. I was always under the false impression that my app syncs with the local cache only if there is internet, but as you methodically explained, sync API does not need internet to store the file in the local cache.
you should read the sync api documentation on the dropbox.com site
I read dropbox documentation, but missed the relationship between sync API and the local cache. What is the exact link for the latter?
Thank you very much for your logical explanation.
 

Kbogle24

Member
Licensed User
Longtime User
I am wanting to share a file once it is uploaded to dropbox. Anyway can dropsync create a link to the file that then could be shared and downloaded by anouther user?
 

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
B4X:
manager.uploadfile(Datadir, "mobilcrm.db","/","mobilcrm.db")
Hi rboeck! This code sounds exactly like I want to do!
Have you got any success experience sharing db with dropbox? Does it works fine updating records or only can update the whole db file?
Do you have any recommendation before I start with this?

Thanks and regards

Lorenzo
 

Debugz

Member
Licensed User
Longtime User
Thanks for this great Libary Erel
and sorry for my English
in pleasant anticipation I make an Update (b4a 4.3)
and include
dropbox-sync-sdk-android.jar, the wrapper (3.1.2) and the DropboxSync Libary (3.0).
Next I registrate my App and testet it with your first example.
When I run the app I get the request to link to my Dropbox and select "Zulassen (Allow)".
Nothing else happens after that.
The app never reaches "Sub Manager_AccountReady"
Here an extrakt of the unfilterd Log
first Link-->LinkAccount---------------------------------------------------------------------
Requesting link for a Dropbox new account.
.
Dropbox user xxxxxxxxx linked.
.
[125] InAppBillingUtils.pickAccount: com.dropbox.android: Account determined from installer data - []
In getpackagename pid = 842 uid = 1000 package name = android
handleKeyguardVisibilityChanged(1)
handleKeyguardVisibilityChanged(1)
handleKeyguardVisibilityChanged(1)
sendKeyguardVisibilityChanged(true)
Performing stop of activity that is not resumed: {b4a.example/com.dropbox.sync.android.DbxAuthActivity}
java.lang.RuntimeException: Performing stop of activity that is not resumed: {b4a.example/com.dropbox.sync.android.DbxAuthActivity}
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3303)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3390)
at android.app.ActivityThread.access$1100(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
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:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
.
second Link-->LinkAccount---------------------------------------------------------------------
Dropbox user xxxxxxxxx linked.
.
Registering app com.dropbox.android of senders xxxxxxxxxxxx
.
onReceive [android.intent.action.ACTIVITY_STATE/com.dropbox.android/create]
.
Created new socket: SSL socket over Socket[address=api.dropbox.com/108.160.166.125,port=443,localPort=47562]
.
client.cpp:79: bad_state: This app is not allowed to use the Sync API for file access.


...Nothing happens....

And my Question:
Must the Package Name correspond with the App Name (Test --> b4a.Test)

Thanks and regards
Norbert
 

Debugz

Member
Licensed User
Longtime User
Sorted. My app was configured to access ALL dropbox folders, not just app. I re-created my app in dropbox with just access to its own folder and bingo it worked.

I registrate a new App with access like gadgetmonster und it works.
It is the same Example,
but then my Root is Apps/MyApp
That ist not what I want.

I have sharing Folder with other People. These Folder to synchronize is my wish.

Thanks and regards
Norbert
 

Andrick

New Member
Licensed User
Longtime User
Using this library

1. Download the Android SDK: https://www.dropbox.com/developers/sync
Unzip it and copy dropbox-sync-sdk-android.jar to the libraries folder.
2. Copy the attached wrapper files to the libraries folder.

Excuse me if I aks a stupid question here but I downloaded the SDK
and copied the dropbox-sync-sdk-android.jar to the B4A libraries folder
What do i have to do to:
2. Copy the attached wrapper files to the libraries folder.
The dropbox sync lib does not apear in the libs tab
I tried to find my solution on the internet but after searching for hours
I could not find what I am doing wrong

Some help would be welcome
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…