Hi,
I'm trying to implement posting data from my device to a Web API.
My facing problem is my post request is executed twice posting for 1 request due to slow network.
do u have any function to disable the auto retry feature of OkHttp.
please advice.
example code as following I call web API:-
I'm trying to implement posting data from my device to a Web API.
My facing problem is my post request is executed twice posting for 1 request due to slow network.
do u have any function to disable the auto retry feature of OkHttp.
please advice.
example code as following I call web API:-
B4X:
Dim json As HttpJob
json.Initialize("MyJobUpdateResult",Me)
Dim m As Map
m.Initialize
m.Put("DocNo",lblISno.Text)
m.Put("SalesNo",lblISsalesno.Text)
m.Put("DocStatus",DocStatus)
m.Put("ActionDate",actiondate)
Dim JSONGenerator As JSONGenerator
JSONGenerator.Initialize(m)
Dim JSONstring As String
JSONstring = JSONGenerator.ToString
Log(JSONstring)
json.PostString(Starter.URILink & "/api/Doctor/PostICS",JSONGenerator.ToString)
json.GetRequest.SetHeader("Authorization","Bearer " & Main.MyToken)
json.GetRequest.SetContentType("application/json")
json.GetRequest.Timeout = 60000
Wait For (json) JobDone(json As HttpJob)
If json.Success Then
Log(json.GetString)
Dim jNDparser As JSONParser
jNDparser.Initialize(json.GetString)
Dim root As Map = jNDparser.NextObject
Dim result As String = root.Get("result")
Dim data As String = root.Get("data")
Dim resultset As String = root.Get("resultset")
'If data.Trim ="Successful" Then
If result.Trim ="1" Then
str="UPDATE TaskList SET SyncResult='Y' "
str=str & " WHERE Docno='" & lblISno.Text & "' "
SQL1.ExecNonQuery(str)
New_ISRNo=data.Trim
End If
Else
End If
json.Release