Dropbox Sync Library

merlin2049er

Well-Known Member
Licensed User
Longtime User
Hmm, how about just mounting the dropbox folder and not necessarily syncing the files?

I'll have to look into the api.
 

GMan

Well-Known Member
Licensed User
Longtime User
After running a longer time an eroor appears (even after restarting the App).
Cannot parse: DropBox Info as Boolean (from sub: main_manager_accountready)
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
Just curious, how many people can be linked to the same dropbox folder? I'd like to keep the contents of my application refreshed easily, and dropbox sync seem the likely solution.
 

Mahares

Expert
Licensed User
Longtime User
@Merlin: Here is an excerpt and a link to Dropbox user policy and the number of users:

Production approval
When you first create a Dropbox API app, it is given development status. Your app functions the same as any production status app except that it can only be accessed by up to 100 users. (You can enable this from your app's info page on theApp Consoleby clickingEnable additional users.) Many apps such as for demos, hackathons, staging environments, and internal tools can stay in development status. However, if you'd like to open your app to more users, you'll need to apply for production status.

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

GMan

Well-Known Member
Licensed User
Longtime User
Just solved - the App status has changed to "Production" and wasn't reachable that time. :oops:

And due i am using a (Vista) 64bit System there aren't ANY log messages :(
 
Last edited:

coslad

Well-Known Member
Licensed User
Longtime User
Hi

i tried this library in a foreground service , but when manager.linkaccount is called , the app crash with the error : NullpointerException .

Any idea ?

Thanks
 

GMan

Well-Known Member
Licensed User
Longtime User
Not really, here is my Sub that works fine in all my apps (initialized as in the sample)
B4X:
Sub Backup_Click
    Manager.Initialize(key, secret, "manager")
    Manager.LinkAccount
End Sub
After that the webbrowser startsautomatically
 

coslad

Well-Known Member
Licensed User
Longtime User
hi

i moved the code from service to activity and to Manager.LinkAccount it opne the browser to an dropbox url , but appear a message that in english sound like " it isn't allow to use this application with the synchronize api"


///SOLVED ///

it must be dropbox app installated onto device , but Erel didn't said it in the first istruction post !!!

BUT now after .LinkAccount call ,never _AccountReady raise .
 
Last edited:

coslad

Well-Known Member
Licensed User
Longtime User
the code is :

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Private manager As DbxAccountManager
  Private key As String = "n4lxziw"
  Private secret As String = "3wzun"
 
End Sub
 
Sub Globals
    Private Button1 As Button
End Sub
 
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        Log("START")
      manager.Initialize(key, secret, "manager")
  End If
  Activity.LoadLayout("1")
End Sub
 
 
Sub Activity_Pause (UserClosed As Boolean)
 
 
End Sub
 
 
 
Sub Button1_Click
    manager.LinkAccount
End Sub
 
 
Sub Manager_AccountReady (Success As Boolean)
  ToastMessageShow ("Account Ready: " & Success,False)
  If Success Then
      For Each FileInfo As DbxFileInfo In manager.ListFiles("/")
        Log(FileInfo.Name & ", " & FileInfo.IsFolder)
      Next
  End If
  'manager.DownloadFile("/", "somefile", File.DirRootExternal, "somefile")
End Sub


Manifest is :

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
AddApplicationText(
<activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
<activity
  android:name="com.dropbox.client2.android.AuthActivity"
  android:launchMode="singleTask" >
  <intent-filter>
    <data android:scheme="db-n4lxziw" /> <!-- NEED TO UPDATE -->
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>
<service
  android:name="com.dropbox.sync.android.DbxSyncService"
  android:enabled="true"
  android:exported="false"
  android:label="Dropbox Sync" />
  )  
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
 

GMan

Well-Known Member
Licensed User
Longtime User
Are the both keys as short as you wrote ?
 

GMan

Well-Known Member
Licensed User
Longtime User
OK, just asked to be sure :cool:

Is the placement (of the DropBox-part in the manifest editor) relevant ?

I use it this way:
B4X:
...
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddApplicationText(
<activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
<activity
  android:name="com.dropbox.client2.android.AuthActivity"
  android:launchMode="singleTask" >
  <intent-filter>
    <data android:scheme="db-1234567890123" /> <!-- NEED TO UPDATE -->
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>
<service
  android:name="com.dropbox.sync.android.DbxSyncService"
  android:enabled="true"
  android:exported="false"
  android:label="Dropbox Sync" />
  )
 

coslad

Well-Known Member
Licensed User
Longtime User
hi Erel

in the log i have found this:

DROPBOX_ERROR_USAGE: sync.cpp:244: This app is not allowed to use the Sync API for file access.

in dropbox app i have as Permission type : Full Dropbox

maybe miss some permission in the manifest ?

any idea ?

//////////SOLVED////////////////

i have found the solution here :

http://stackoverflow.com/questions/19139334/two-way-sync-app-core-api-or-sync-api

As to permissions, the Sync API does not support "Full Dropbox" permission, so you'll have to use either "File type" permission (access to certain types of files by extension) or "App folder" permission (access to any type of file but only within a designated folder for your app, e.g. Dropbox/Apps/).

Now the _AccountReady return true
 
Last edited:
Top