I have access to my Dropbox account and retrieved an accesstoken. However when I try to download a file nothing happens, no error and it doesn't trigger a "dbxFiles_DownloadFinished" event. I tried putting the download inside a try/catch but that didn't provide an exception either. Can anyone see something that I have missed?
Thank you.
Brad
my code is:
I then try to download a file from Dropbox from a button click
There is no Exception triggered in the Try.
This Sub is never activated:
My Manifest is:
Thank you.
Brad
my code is:
B4X:
#Region Project Attributes
#ApplicationLabel: DrpBx.Test
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalJar:dropbox-android-sdk-6.0.0.aar
#AdditionalJar:dropbox-core-sdk-6.0.0
#AdditionalJar: androidx.legacy:legacy-support-core-utils
#AdditionalJar: jackson-core-2.7.4.jar
#MultiDex: true
#End Region
Sub Process_Globals
Dim auth As DbxAuth
Dim Dropbox As DropboxV2
Dim client As DbxClientV2
Dim config As DbxRequestConfig
Dim dbxFiles As DbxUserFilesRequests
Dim dbxSharing As DbxUserSharingRequests
Dim dbxUsers As DbxUserUsersRequests
Dim token As String
Dim dbxPath As String = "Apps\DrpBx.Test\SubFolder\"
Dim MyPath As String=File.DirInternal
Dim MyFile As String ="TestLogfile.txt"
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
auth.Initialize("App_Key")
dummy = "sl.BuNxatYjIkXBIN ... etc" .....Short term token from "auth.startOAuth2Authentication"
If dummy <> "" Then
token = dummy
Log("Token available (Activity Create. Try to enable Dropbox with this token")
config.Initialize("",token,"de-de",5)
Dim dbxhost As DbxHost
dbxhost.Initialize
client.Initialize("Dropbox",config,token,dbxhost)
dbxFiles = client.files
dbxFiles.setEventname("dbxFiles")
dbxSharing = client.sharing
dbxSharing.setEventname("dbxSharing")
dbxUsers = client.users
dbxUsers.setEventname("dbxUsers")
DropboxEnabled = True
Else
DropboxEnabled = False
End If
Dropbox.Initialize("")
End Sub
I then try to download a file from Dropbox from a button click
B4X:
Private Sub BtnDownload_Click
Try
dbxFiles.download(dbxPath & MyFile, MyPath, MyFile)
Catch
Log(LastException)
End Try
End Sub
There is no Exception triggered in the Try.
This Sub is never activated:
B4X:
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String)
If meta = Null Then
Log($"dbxFiles_DownloadFinished(${success}, ${error})"$)
Else
Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$)
End If
If error.Contains("Exception") Then
Log(LastException)
End If
ToastMessageShow("Download Completed",True)
End Sub
My Manifest is:
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String) If meta = Null Then Log($"dbxFiles_DownloadFinished(${success}, ${error})"$) Else Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$) End If If error.Contains("Exception") Then Log(LastException) End If ToastMessageShow("Download Completed",True) End SubSub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String) If meta = Null Then Log($"dbxFiles_DownloadFinished(${success}, ${error})"$) Else Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$) End If If error.Contains("Exception") Then Log(LastException) End If ToastMessageShow("Download Completed",True) End Sub:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
AddApplicationText(<activity
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:exported="true"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="db-5iyw0lvn7jpvw4w" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="33" />
)