Hi, I've made an Application with B4A that connects to the server to download some information and some images.
This is my code :
Private Sub trylogin
Dim JJ As HttpJob
JJ.Initialize("", Me) 'name is empty as it is no longer needed
ProgressDialogShow2("درحال برقراری ارتباط",False)
JJ.Download(Main.URLC & "index.php")
Log(Main.URLC & "index.php")
Wait For (JJ) JobDone(JJ As HttpJob)
If JJ.Success Then
ProgressDialogHide
'The result is a json string. We parse it and log the fields.
Dim list1 As List
Dim res As String,s1 As SQL
Dim m1 As Map
res = JJ.Getstring
Dim js As JSONParser
Dim gr As Int
Try
js.Initialize(res)
list1 = js.NextArray
Catch
ProgressDialogHide
Msgbox2Async( "سرور در دسترس نیست یا آی پی داده شده صحیح نمی باشد", "","تایید", "","",Null,True)
' Return False
End Try
End Sub
Is This the correct way to use Http job?(I'm using {OkHttpUtils2} and {JSON} Library for this code)
This is my code :
Private Sub trylogin
Dim JJ As HttpJob
JJ.Initialize("", Me) 'name is empty as it is no longer needed
ProgressDialogShow2("درحال برقراری ارتباط",False)
JJ.Download(Main.URLC & "index.php")
Log(Main.URLC & "index.php")
Wait For (JJ) JobDone(JJ As HttpJob)
If JJ.Success Then
ProgressDialogHide
'The result is a json string. We parse it and log the fields.
Dim list1 As List
Dim res As String,s1 As SQL
Dim m1 As Map
res = JJ.Getstring
Dim js As JSONParser
Dim gr As Int
Try
js.Initialize(res)
list1 = js.NextArray
Catch
ProgressDialogHide
Msgbox2Async( "سرور در دسترس نیست یا آی پی داده شده صحیح نمی باشد", "","تایید", "","",Null,True)
' Return False
End Try
End Sub
Is This the correct way to use Http job?(I'm using {OkHttpUtils2} and {JSON} Library for this code)