Android Question Detect events or wait for in module or service.

netsistemas

Active Member
Licensed User
Longtime User
I need to do a service when upload file with Dropbox (or other case).

How detect events in a service.

And how use WAIT FOR in service or module.

Sample code imposible in module or service:

dbxFiles.upload(RutaDescarga, "b.jpg",FileWeb,False,False)
wait for dbxFiles_UploadFinished(success As Boolean, meta As FileMetadata, error As String)
 

netsistemas

Active Member
Licensed User
Longtime User
ok. perfect. only say
the event name for delete files is:

B4X:
wait for  dbxFiles_Delete(success As Boolean,  msg As Object ,error As String)
            Dim I As FileMetadata
            i = msg

this is a sample and the error know in this funcion (and solution)

B4X:
public Sub UploadFile
    Try
        If modDB.ElDummy  <> "" Then
            Log("uploaded file to dropbox1")
            dbxFiles.upload(modDB.RutaDescarga, modDB.FileDescarga,modDB.FileWeb,False,False)
            Log("uploaded file to dropbox2")
       
            wait for dbxfiles_uploadfinished(success As Boolean, meta As FileMetadata, error As String)
            Log("log7")
            Sleep(2000)
            Log("uploaded file to dropbox tras sleep ")

       
            dbxFiles.delete(modDB.FileWeb)
            Log("log11")
            'wait for dbxFiles_Delete(success As Boolean, meta As FileMetadata, error As String)
            'in DEGUG OK, but in Release:
            'CATCH DETECTED: Borrar error en modDb.(ClassCastException) java.lang.ClassCastException: com.dropbox.core.v2.files.FileMetadata cannot be cast to de.donmanfred.dbxv2.files.FileMetadataWrapper
            'and LOG12 next lines are not called
       
            'this is ALTERNATIVE correct
            wait for  dbxFiles_Delete(success As Boolean,  msg As Object ,error As String)
            Dim I As FileMetadata
            i = msg
         
            Log("log12")
        End If
    Catch
        Log("Borrar error en modDb." & LastException)
    End Try
End Sub

Is important the var code define for msg is object in dbxfiles_delete event.
If you define like:

msg As FileMetadata -> error en release mode
meta As FileMetadata -> error in compilate

There are not in documentation and in not in the wait for 'code helper'
 
Last edited:
Upvote 0
Top