Help with http size

psdos

Active Member
Licensed User
Longtime User
Help with http size (Solved)

I need that you help me with http size, i has one service for know the size of url link file in dropbox or other web, ftp. In v1.80 this go very well, but at update at v2.0.2 this service is not well. This is the code

B4X:
'Service module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim hc_size As HttpClient
   Dim req_size As HttpRequest
   Public Tamaño As Int
End Sub
Sub Service_Create
   hc_size.Initialize("hc_size")
   req_size.InitializeGet("http://dl.dropbox.com/*/*****/****.db")
   req_size.Timeout = 10000
End Sub

Sub Service_Start (StartingIntent As Intent)
   hc_size.Execute(req_size, 1)
End Sub

Sub Service_Destroy
   
End Sub

Sub hc_size_ResponseSuccess(Response As HttpResponse, TaskId As Int)
    Tamaño = Response.ContentLength
   Log(Tamaño)
   Main.Tamaño_Url = Tamaño
   StopService("")
End Sub

Sub hc_size_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
    Msgbox("Error4: " & Reason, "")
   Main.Mensaje = 5
   If Msgbox2("Error5: " & LastException, "*****", "SALIR", "", "", Null) = DialogResponse.POSITIVE Then
      CancelScheduledService(DeviceWakupService)
       ExitApplication
   End If
End Sub

I use this for know size from link url
B4X:
StartService(HTTPSIZE)

Log (HTTPSIZE.Tamaño)

PD:Sorry, It is solvet yet. Thanks.
 
Last edited:
Top