Android Question HttpUtils2 Upload jobname + actual data string

sangee

Member
Licensed User
Hello Community,

I am using httputils2 to upload some string data to my web server using below code..

B4X:
 Dim job2 As HttpJob
 Dim upload_Str As String
' This function returns the current time stamp in a unique format required for my web application
upload_Str = GetCurrentTime()
job2.Initialize("UploadTmstmp", Me)
job2.Download2("http://server/cgi-bin/receivetmpstmp.pl",Array As String("action", "receive", "devicename", Hostname, "tmpstamp",upload_Str))

My server receives and stores the data in the database. This works perfectly. I face problem when for some reason the server is not reachable and upload fails. I must not miss any data collected.

In the JobDone section I am planning to save the failed upload strings to a sqlite DB to be uploaded later. I am not able to figure out how do I pass on the string value along with the jobname so that I can add only failed upload strings to the DB.

B4X:
If Job.Success = True Then
        Select Job.JobName
            Case "UploadFile"
                UploadSuccess = Uploadsuccess + 1
       
            Case "StatCheck"
                FailureCounter = 0

            Case "UploadFile"
                UploadSuccess = Uploadsuccess + 1               

        End Select
    Else
        Select Job.JobName
            Case "UploadFile"
                UploadInProg = UploadInProg - 1
               
            Case "StatCheck"
                'Log("Error on Status. Failcounter=" & FailureCounter)
                FailureCounter = FailureCounter + 1
               
            Case "UploadTmstmp" ' Ok we have a Timestamp data upload error. Save to DB for uploading later
                'Not able to figure out how to get or pass the actual string value being uploaded and save it to DB.
                SQL1.ExecNonQuery("INSERT INTO table1 VALUES('abc', 1, 2)")

        End Select   
    End If
    Job.Release
Catch
    Return
End Try

Can any one help please..

Thanks,
Sangee
 
Top