B4A Library CloudRail - CloudStorage (Dropbox, GoogleDrive, OneDrive and Box) Payment (PayPal, Stripe), POI

Husam

Member
Licensed User

add " DG1100216100816.txt " file name to destPath , it should work
B4X:
dropbox.upload(File.DirRootExternal & "/HHE/DG1100216100816.txt","/Import/DG1100216100816.txt",0,True)
 

DonManfred

Expert
Licensed User
Longtime User
https://github.com/CloudRail/cloudr...sage#interfaces-cloudstorage-functions-upload
 

Mahares

Expert
Licensed User
Longtime User
When I switched from a device with OS 4.2.2 to a device with OS 6.0.1, the upload and download work very well. But, with OS 4.2.2, I was constantly denied. Here is the error on 4.2.2:
B4X:
com.cloudrail.si.exceptions.HttpException: {"error_description": "code has already been used", "error": "invalid_grant"}
 

Mahares

Expert
Licensed User
Longtime User
Downloading multiple files from a given Dropbox subfolder gives me this error:
'Object reference not set to an instance of an object'
Here is my code:
B4X:
Dim MyExport As String= "/Export"
Sub Dropbox_Ready(Success As Boolean)
    Log($"Dropbox_Ready(${Success})"$)
    dropbox.getChildren(MyExport)
    Dim MyList As List
    MyList.Initialize
    For Each meta As CloudMetaData In dropbox.getChildren(MyExport)  '<--- Here is the problem
        MyList.Add(meta.name)
    Next
   
    For Each f As String In MyList
        If f.EndsWith(".tab") Then
            dropbox.download(MyExport & "/" & f, File.DirRootExternal,  "/" & f    )
        End If
    Next
End Sub
I appreciate your help if you can.
 

DonManfred

Expert
Licensed User
Longtime User
getChildren is an async task and it raises an event where you get the result. eventname_children
Not that getChildren does not have a return value. so the code
B4X:
 For Each meta As CloudMetaData In dropbox.getChildren(MyExport)
will not work

Built your downloadlist inside this event
 

Mahares

Expert
Licensed User
Longtime User
I am trying to download a few files from google drive to a folder in the device using this powerful library. But, every time the app runs, the app stops and the screen requests permission like this before continuing:
‘Name of the project that created the client ID’ would like to have offline access:
Below the message are 2 buttons: one says:’ Deny’ and the other ‘Allow’. Obviously I click the ‘Allow’ button. The app continues, downloads the files occasionally but crashes most of the time.

The error despite Google Drive API being enabled when I created the client ID and secret says:
com.cloudrail.si.exceptions.HttpException: Forbidden - Make sure that the Google Drive API is enabled.

Has anyone including @DonManfred tried the Google Drive portion of this lib in a project and can share their findings.

Thank you
 

Paulsche

Well-Known Member
Licensed User
Longtime User
Is there a sample code for upload and download a file to/from Google Drive?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Is there a sample code for upload and download a file to/from Google Drive?
i did only a few (very few) tests with google drive.

B4X:
    drive.upload(File.Combine(File.DirRootExternal,"WhatsAppSetup.exe"),"/Cloudrail/WhatsAppSetup.exe",File.Size(File.DirRootExternal,"WhatsAppSetup.exe"), True)
    Drive.download("/B4A/MaterialDesign-Webfont-master.zip",rp.GetSafeDirDefaultExternal("Downloads"),"MaterialWebfont.zip")

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim dropbox As Dropbox
    Dim drive As GoogleDrive
    Dim cr As CloudRail
    Dim places As GooglePlaces
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
   If Permission = rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then
   End If
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    cr.Initialize("CloudRail","xxxx")
End Sub
Sub CloudRail_Ready(Success As Boolean)
    Log($"CloudRail_Ready(${Success})"$)
    If Success Then
        'dropbox.Initialize("Dropbox","yyyy","zzzz")
        drive.Initialize("Drive","0000000","11111111")
        'places.Initialize("Places","222222")
        'places.NearbyPOIs(49.4557091, 8.5279138, 3000, "Restaurant", Null)
    End If
End Sub
Sub Drive_Ready(Success As Boolean)
    Log($"Drive_Ready(${Success})"$)   
    drive.getChildren("/Cloudrail")
    'drive.checkAllocation
   
    'drive.upload(File.Combine(File.DirRootExternal,"CloudRailV1.0.zip"),"/Cloudrail/CloudRailV1.0.zip",File.Size(File.DirRootExternal,"CloudRailV1.0.zip"), True)
    'drive.upload(File.Combine(File.DirRootExternal,"CloudRailV1.1.zip"),"/Cloudrail/CloudRailV1.1.zip",File.Size(File.DirRootExternal,"CloudRailV1.1.zip"), True)

    'drive.upload(File.Combine(File.DirRootExternal,"WhatsAppSetup.exe"),"/Cloudrail/WhatsAppSetup.exe",File.Size(File.DirRootExternal,"WhatsAppSetup.exe"), True)
    'Drive.download("/B4A/MaterialDesign-Webfont-master.zip",rp.GetSafeDirDefaultExternal("Downloads"),"MaterialWebfont.zip")
   
   
    'Drive.getMetadata("/b4a")
End Sub
Sub Drive_DownloadFinished(success As Boolean, info As String, filePath As String, destPath As String, destFile As String)
    Log($"Drive_DownloadFinished(${destFile}->${success},${destFile},${filePath})"$)   
End Sub
Sub Drive_UploadFinished(destPath As String, info As String, success As Boolean)
    Log($"${destPath}, ${info}, ${success}"$)
End Sub
 

Paulsche

Well-Known Member
Licensed User
Longtime User
Ok, upload a file works. But when enable CloudRail, the Lib Geocoder does not work anymore,
Where I can see the location with the name and the street.
 

Paulsche

Well-Known Member
Licensed User
Longtime User
I guess it is because of the same objectnames... both libs does have a Address object...

yes I believe that too. I do not know if I can replace the CloudRail the geocoder. Actually, I've got Dropbox, GoogleDrive already through another Lib,
LibGoogleDrive, my problem with this is that I can not upload a large file over 50MB in Google Drive, because there is a memory error, which does not come with CloudRail.
 

Paulsche

Well-Known Member
Licensed User
Longtime User
When connecting to GoogleDrive every time the confirmation for offline access, can not save it?
 

Paulsche

Well-Known Member
Licensed User
Longtime User
I did not understand.
Vielleicht zusätzlich in deutsch?
OK, die Bestätigung für den Offline-Zugriff wird nicht gespeichert
und bei jedem Connect neu abgefragt, siehe Anhang.
Wie kann man diese Bestätigung speichern, so dass sie nur 1 x abgefragt wird ?

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…