B4A Library Dropbox SDK V2 - Java

dropbox_blue.png



This is a wrap for the Dropbox JAVA SDK for Android.

It is a request for the community too to parcitipate to this project doing test or writing documentation for the objects.

List of connected Tutorials:
- Dropbox SDK V2 - Authentification
- Dropbox SDK V2 - Uploading big files to Dropbox
- Dropbox SDK - get informed about changes in the used Dropbox


DropboxV2
Comment:
The Dropbox library allows you to communicate with Dropbox
Author: DonManfred (wrapper)
Version: 0.65 (wraps the SDK dropbox-core-sdk-6.0.0)

Wrapped Objects so far
  • DbxAuth
  • DbxClientV2
  • DbxHost
  • Dimensions
  • DbxRequestConfig
  • DbxUserAuthRequests
  • DropboxV2
  • DbxUserFilesRequests
  • FileMetadata
  • FolderMetadata
  • FolderSharingInfo
  • GpsCoordinates
  • Mediainfo
  • MediaMetadata
  • Metadata
  • RelocationPath
  • DbxUserSharingRequests
  • MemberSelector
  • SharedFileMetadata
  • SharedFolderMetadata
  • SharedLinkMetadata
  • BasicAccount
  • FullAccount
  • DbxUserUsersRequests

The Download will always be here in Post #1 of the Thread.

Additional to the provided Library (xml and jar) you need to download:
1. Download this file.
Extract the zip and copy the files to your additional libraries folder.

Add this lines to your Mainmodule
B4X:
#AdditionalJar:dropbox-android-sdk-6.0.0.aar
#AdditionalJar:dropbox-core-sdk-6.0.0


In the following posts i´ll add some more detailed info on the different Objects.
 
Last edited:

Sabotto

Active Member
Licensed User
Please help me.

I downloaded and modified the project and downloaded the libraries
I'm getting an error here

B4X:
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    kvs.Initialize(File.DirDefaultExternal, "datastore2")
End Sub

Logger connesso a: LCL0218907002357
--------- beginning of crash
--------- beginning of system
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
Error occurred on line: 16 (Starter)
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (Sqlite code 14 SQLITE_CANTOPEN): Could not open database, (OS error - 2:No such file or directory)
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:231)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:213)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:553)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:215)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:204)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:948)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:927)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:818)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:765)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.example3.keyvaluestore._initialize(keyvaluestore.java:362)
at b4a.MioDropbox.starter._service_create(starter.java:152)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at b4a.MioDropbox.starter.onCreate(starter.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4521)
at android.app.ActivityThread.access$2600(ActivityThread.java:296)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2243)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
** Service (starter) Start **


What can it be?
These are the used librarie

1596269886636.png
 

netsistemas

Active Member
Licensed User
Longtime User
Permision?

or

i use this code:
and mayby, review this link:
'https://b4x.com/android/forum/threa...ory-file-dirdefaultexternal-not-exists.93099/

B4X:
Sub RutaDBCorrecta() As String
Dim TargetDir As String

'https://b4x.com/android/forum/threads/no-such-file-or-directory-file-dirdefaultexternal-not-exists.93099/


If File.ExternalWritable  Then'
    'Private rp As RuntimePermissions
    TargetDir =  Starter.rp.GetSafeDirDefaultExternal("") ' File.DirDefaultExternal
Else
    TargetDir = File.DirInternal
End If

Return TargetDir
End Sub

in starter i have this code:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Public rp As RuntimePermissions


    
    
End Sub
 

Pr@do

New Member
View attachment 51210


This is a begin of a wrap for the Dropbox JAVA SDK
In fact v0.4 is a decompiled v0.28 library. I did changed it then to be able to compile it again. In my tests all is working now (all what i tested :D). The Library is still beta. But i´m now able to change things again ;-)

It is a request for the community too to parcitipate to this project doing test or writing documentation for the objects.

List of connected Tutorials:
- Dropbox SDK V2 - Authentification
- Dropbox SDK V2 - Uploading big files to Dropbox
- Dropbox SDK - get informed about changes in the used Dropbox


DropboxV2
Comment:
The Dropbox library allows you to communicate with Dropbox
Author: DonManfred (wrapper)
Version: 0.42 (wraps the SDK dropbox-core-sdk-3.0.7)

Wrapped Objects so far
  • DbxAuth
  • DbxClientV2
  • DbxHost
  • Dimensions
  • DbxRequestConfig
  • DbxUserAuthRequests
  • DropboxV2
  • DbxUserFilesRequests
  • FileMetadata
  • FolderMetadata
  • FolderSharingInfo
  • GpsCoordinates
  • Mediainfo
  • MediaMetadata
  • Metadata
  • RelocationPath
  • DbxUserSharingRequests
  • MemberSelector
  • SharedFileMetadata
  • SharedFolderMetadata
  • SharedLinkMetadata
  • BasicAccount
  • FullAccount
  • DbxUserUsersRequests

The Download will always be here in Post #1 of the Thread.

Additional to the provided Library (xml and jar) you need to download:
1. dropbox-core-sdk-3.0.7 Copy the file to your additional libraries folder.
2. jackson-core-2.7.4.jar. Extract from the zip attached and copy the file to your additional libraries folder.


In the following posts i´ll add some more detailed info on the different Objects.
Hi, I'm researching how to develop an Android app that reads and writes some files from my Dropbox.
The app in question would only be used for my Dropbox and therefore I would like to use only my app tocken for authentication.
From the following forum I read about using the DropboxV2V0.44 library, the jackson-core-2.7.4.jar and dropbox-core-sdk-3.0.7 (which is obsolete today).
Are these files still valid for my app?
Thank you and good day.
 

DonManfred

Expert
Licensed User
Longtime User
Do you intend to modify the DropboxV2.xml file by replacing "dropbox-core-sdk-3.0.10" with "dropbox-core-sdk-4.0.1" or "dropbox-core-sdk-5.0.0"?
You can do it by yourself- It is one line to edit in the xml.
I don´t know whether i tested it with the v5 jar or not.
With v4 i am working with the lib.

For any other question/issie; please create a new thread in the questionsforum.
 

NGUYEN TUAN ANH

Active Member
Licensed User
View attachment 51210


This is a wrap for the Dropbox JAVA SDK for Android.

It is a request for the community too to parcitipate to this project doing test or writing documentation for the objects.

List of connected Tutorials:
- Dropbox SDK V2 - Authentification
- Dropbox SDK V2 - Uploading big files to Dropbox
- Dropbox SDK - get informed about changes in the used Dropbox


DropboxV2
Comment:
The Dropbox library allows you to communicate with Dropbox
Author: DonManfred (wrapper)
Version: 0.42 (wraps the SDK dropbox-core-sdk-3.0.7)

Wrapped Objects so far
  • DbxAuth
  • DbxClientV2
  • DbxHost
  • Dimensions
  • DbxRequestConfig
  • DbxUserAuthRequests
  • DropboxV2
  • DbxUserFilesRequests
  • FileMetadata
  • FolderMetadata
  • FolderSharingInfo
  • GpsCoordinates
  • Mediainfo
  • MediaMetadata
  • Metadata
  • RelocationPath
  • DbxUserSharingRequests
  • MemberSelector
  • SharedFileMetadata
  • SharedFolderMetadata
  • SharedLinkMetadata
  • BasicAccount
  • FullAccount
  • DbxUserUsersRequests

The Download will always be here in Post #1 of the Thread.

Additional to the provided Library (xml and jar) you need to download:
1. dropbox-core-sdk-3.0.7 Copy the file to your additional libraries folder.
2. jackson-core-2.7.4.jar. Extract from the zip attached and copy the file to your additional libraries folder.


In the following posts i´ll add some more detailed info on the different Objects.
Dear Sir,
I have successfully connected my B4A application to Dropbox, and in my code I have copied my test.txt file into the Dropbox folder, but I don't know how in the runtime code how to share the test.txt file and get the url link to the shared test.txt file for me send to my friend, in my runtime code. Could you please help me do this,
PS: I used code:
B4X:
Dim SST As SharedLinkSettings
SST.Initialize("PUBLIC","",DateTime.DateParse("01/01/2050"))
dbxSharing.createSharedLinkWithSettings("/TT1/test.txt",SST)
But I don't know how to get url of share file
thank you very much.!
Best Regards
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Target SDK 31+

Hiya all, long time no interacting :), well not you Manfred as we interact away from the forum ;)

After changing the target SDK to 31 in B4A, I was greeted with the following error message whilst trying to install my application (with absolutely no compiling issues) onto any device. The following screenshot message appears after trying to install my application onto any device, it does not happen using target SDK 30 and below, only whist targeting SDK to 31+.
1670244409581.png


To fix the issue above you just need to add the following line to the Dropbox manifest code and everything will start working again.
B4X:
    android:exported="true"

AddApplicationText(<activity
android:name="com.dropbox.core.android.AuthActivity"
android:exported="true"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<intent-filter>
<data android:scheme="db-xxx" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>)


Enjoy...
 
Last edited:

Juan Vargas (Bioagro)

Member
Licensed User
After uploaded a file, I get this error
B4X:
available Memory = 357.49375915527344 MB
Token available (Activity Create. Try to enable Dropbox with this token
files:listFolder()
files:listFolderContinue(AAF-ffiP06gPb3cpnXaYHXNCDGqHejMDXJKGVtAj07z2ahEpKOTH3VZ0DxZanLB6CfMQ2aI1ihGtd4GHsChHqQH5b63rWHmRBNl-F7rsNxGSmFLQDxdmULY6GQugD9msD8rsgL6lj2PlZp7IQY0hCVMJ1yZUlc29nRxrKjr4ySrem8Uroe-MXbAk5emoSeCa1UZJ6eiBI41P1UBUYOSZJFfXgo-EwlfQEWV3CS9rQysOpw)
UploadErrorException:com.dropbox.core.v2.files.UploadErrorException: Exception in 2/files/upload: {".tag":"path","reason":{".tag":"conflict","conflict":"folder"},"upload_session_id":"pid_upload_session:ABIHLR-LLkmjwHZzYv14SbccQOdsPvTVJWFY2v-qWTIh99nrBw"}
Error occurred on line: 0 (Main)
java.lang.Exception: Sub dbxfiles_uploadfinished signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.tropic.invoicefull.main_subs_0._dbxfiles_uploadfinished(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception

class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject, class java.lang.String, class java.lang.String,
java.net.SocketException: Socket closed
    at java.net.SocketInputStream.read(SocketInputStream.java:209)
    at java.net.SocketInputStream.read(SocketInputStream.java:144)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:267)
    at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
    at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
    at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:119)
    at java.lang.Thread.run(Thread.java:923)
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.


The sub is this, as listed in the documentation

B4X:
Sub dbxFiles_UploadFinished(success As Boolean, meta As FileMetadata, error As String)
    
End Sub

The call line is this

dbxFiles.Upload(Folder,"master.db",FTPMainFolder,False,False):
    dbxFiles.Upload(Folder,"master.db",FTPMainFolder,False,False)


Any help please.
 

netsistemas

Active Member
Licensed User
Longtime User
ChatGPT:(SORRY by copy and paste)

The error you posted is related to a Java program, and it appears to be interacting with the Dropbox API. Here's a breakdown of the error messages:

  1. UploadErrorException:com.dropbox.core.v2.files.UploadErrorException: Exception in 2/files/upload: This indicates an error during the upload of a file to Dropbox. The specific error is a conflict with an existing folder. It seems like you're trying to upload a file to a path that already exists as a folder.
  2. Error occurred on line: 0 (Main) java.lang.Exception: Sub dbxfiles_uploadfinished signature does not match expected signature.: This suggests a mismatch in the method signature of the dbxfiles_uploadfinished subroutine. The expected signature doesn't match the actual one.
  3. java.net.SocketException: Socket closed: This indicates that there was an attempt to read from a socket that has been closed. This could be related to network issues or unexpected disconnection.
Without the actual code, it's challenging to provide a specific solution, but here are some general recommendations:

  • Check the Dropbox API calls: Ensure that you are providing the correct parameters and that the paths you are using for file uploads do not conflict with existing folders.
  • Review the dbxfiles_uploadfinished subroutine: Verify that the method signature matches the expected signature. It seems there might be a mismatch in the way the method is defined or called.
  • Handle network issues: The SocketException: Socket closed error indicates a problem with the network connection. Ensure that your network connection is stable and that you are handling network-related exceptions appropriately in your code.
If you can provide more details about the relevant code sections, I might be able to offer more specific assistance.
 
Top